diff --git a/core/attributedef.class.inc.php b/core/attributedef.class.inc.php index 11c856ac5..e54f83741 100644 --- a/core/attributedef.class.inc.php +++ b/core/attributedef.class.inc.php @@ -2106,8 +2106,7 @@ class AttributeEmailAddress extends AttributeString { public function GetValidationPattern() { - // return "^([0-9a-zA-Z]([-.\\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\\w]*[0-9a-zA-Z]\\.)+[a-zA-Z]{2,9})$"; - return "^[a-zA-Z0-9._&-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9-]{2,}$"; + return $this->GetOptional('validation_pattern', '^'.utils::GetConfig()->Get('email_validation_pattern').'$'); } public function GetAsHTML($sValue, $oHostObject = null, $bLocalize = true) diff --git a/core/config.class.inc.php b/core/config.class.inc.php index 60ff14167..b7c403959 100644 --- a/core/config.class.inc.php +++ b/core/config.class.inc.php @@ -640,6 +640,14 @@ class Config 'source_of_value' => '', 'show_in_conf_sample' => true, ), + 'email_validation_pattern' => array( + 'type' => 'string', + 'description' => 'Regular expression to validate/detect the format of an eMail address', + 'default' => "[a-zA-Z0-9._&'-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9-]{2,}", + 'value' => '', + 'source_of_value' => '', + 'show_in_conf_sample' => true, + ), 'log_kpi_duration' => array( 'type' => 'integer', 'description' => 'Level of logging for troubleshooting performance issues (1 to enable, 2 +blame callers)',