The emailRegexValidator and the urlRegexValidator settings

Current version: 10.4

To validate a contact's email address and any URLs that a contact clicks in an email message, the Email Experience Manager (EXM) uses the following two settings:

  • emailRegexValidator – used to verify that a string is in valid email format, for example, when EXM validates an email address during a dispatch.


    If you use EXM Delivery Cloud, the email delivery service also validates the email addresses during the dispatch of an email campaign. Therefore, there is a risk that EXM Delivery Cloud validates an email address but EXM does not, or the other way around.

  • urlRegexValidator – used to check if a string is a valid URL when a contact clicks a link in an email message.

Both settings can use any regular expression for validation as a value. You can replace the default value with your custom regex. To keep a record of the initial value, you can modify the settings by commenting out the default value or overriding the configuration file.

You can define the settings in the \App_Config\Sitecore\EmailExperience\Sitecore.EmailExperience.Core.config file in the <sitecore>/<settings> section:

  • The emailRegexValidator setting:

            Regex validation for emails
    <emailRegexValidator type="Sitecore.Modules.EmailCampaign.Validators.RegexValidator, Sitecore.EmailCampaign" singleInstance="true">
        <param desc="regexValue" ref="settings/setting[@name='EXM.EmailValidationRegex']/@value" />

You can define the regular expression in the following setting:


<!-- The regular expression used for e-mail validation. -->
<setting name="EXM.EmailValidationRegex" value="^[\p{L}0-9\+\-_\!\$\%\&amp;\*\?]+(?:\.[\p{L}0-9\+\-_\'\!\$\%\&amp;\*\?]+)*@(([\p{L}0-9\-]+(?:\.[\p{L}0-9]+)+)|(\[\d{1,3}(\.\d{1,3}){3}\]))$" />

  • The urlRegexValidator setting:

            Regex validation for URLs
    <urlRegexValidator type="Sitecore.Modules.EmailCampaign.Validators.RegexValidator, Sitecore.EmailCampaign" singleInstance="true">
        <param desc="regexValue" ref="settings/setting[@name='EXM.UrlValidationRegex']/@value" />

You can define the regular expression in the following setting:


<!-- The regular expression used for url validation. -->
<setting name="EXM.UrlValidationRegex" value="^(http|https){1}\:\/\/(([a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]?)\.)*([a-zA-Z0-9][A-Za-z0-9\-]{0,61}[A-Za-z0-9]?)(:\d{2,5})?(\/[a-zA-Z0-9][A-Za-z0-9\-]{0,61}[A-Za-z0-9]?)*(\/{1})?$" />


The default regex is not RFC compliant and does not cater for all cases. To address specific regional use cases or business needs, you must use a custom regular expression.

Do you have some feedback for us?

If you have suggestions for improving this article,