The emailRegexValidator and the urlRegexValidator settings
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.NoteIf 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
emailRegexValidatorsetting:
You can define the regular expression in the following setting:
-
The
urlRegexValidatorsetting:
You can define the regular expression in the following setting:
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.