diff --git a/etemplate/inc/class.etemplate_widget_url.inc.php b/etemplate/inc/class.etemplate_widget_url.inc.php index d130847495..b7023fc060 100644 --- a/etemplate/inc/class.etemplate_widget_url.inc.php +++ b/etemplate/inc/class.etemplate_widget_url.inc.php @@ -19,9 +19,21 @@ class etemplate_widget_url extends etemplate_widget { /** - * Regexes for validating + * Regexes for validating email addresses incl. email in angle-brackets eg. + * + "Ralf Becker " + * + "Ralf Becker (Stylite AG) " + * + "" or "rb@stylite.de" + * + '"Becker, Ralf" ' + * + "'Becker, Ralf' " + * but NOT: + * - "Becker, Ralf " (contains comma outside " or ' enclosed block) + * - "Becker < Ralf " (contains < ----------- " ---------------) + * + * About umlaut or IDN domains: we currently only allow German umlauts in domain part! + * + * Same preg is in et2_widget_url Javascript class! */ - const EMAIL_PREG = '^(?:[ a-z0-9.!#$%&\'*+\/=?^_`{|}\(\)~-]+<)?[^\x00-\x20()<>@,;:\"\[\]]+@([a-z0-9ÄÖÜäöüß](|[a-z0-9ÄÖÜäöüß_-]*[a-z0-9ÄÖÜäöüß])\.)+[a-z]{2,6}'; + const EMAIL_PREG = "/^(([^\042',<][^,<]+|\042[^\042]+\042|\'[^\']+\'|)\s?<)?[^\x00-\x20()<>@,;:\042\[\]]+@([a-z0-9ÄÖÜäöüß](|[a-z0-9ÄÖÜäöüß_-]*[a-z0-9ÄÖÜäöüß])\.)+[a-z]{2,6}>?$/i"; /** * Validate input diff --git a/etemplate/js/et2_widget_url.js b/etemplate/js/et2_widget_url.js index a9a2c7aad5..a0d218adad 100644 --- a/etemplate/js/et2_widget_url.js +++ b/etemplate/js/et2_widget_url.js @@ -31,9 +31,24 @@ var et2_url = et2_textbox.extend( } }, - // PREG for client-side validation copied from etemplate_widget_url - // using \042 instead of " to NOT stall minifyer! - EMAIL_PREG: new RegExp(/^(?:[ a-z0-9.!#$%&'*+/=?^_`{|}\(\)~-]+<)?[^\x00-\x20()<>@,;:\042\[\]]+@([a-z0-9ÄÖÜäöüß](|[a-z0-9ÄÖÜäöüß_-]*[a-z0-9ÄÖÜäöüß])\.)+[a-z]{2,6}/i), + /** + * Regexes for validating email addresses incl. email in angle-brackets eg. + * + "Ralf Becker " + * + "Ralf Becker (Stylite AG) " + * + "" or "rb@stylite.de" + * + '"Becker, Ralf" ' + * + "'Becker, Ralf' " + * but NOT: + * - "Becker, Ralf " (contains comma outside " or ' enclosed block) + * - "Becker < Ralf " (contains < ----------- " ---------------) + * + * About umlaut or IDN domains: we currently only allow German umlauts in domain part! + * + * Using \042 instead of " to NOT stall minifyer! + * + * Same preg is in etemplate_widget_url PHP class! + */ + EMAIL_PREG: new RegExp(/^(([^\042',<][^,<]+|\042[^\042]+\042|\'[^\']+\'|)\s?<)?[^\x00-\x20()<>@,;:\042\[\]]+@([a-z0-9ÄÖÜäöüß](|[a-z0-9ÄÖÜäöüß_-]*[a-z0-9ÄÖÜäöüß])\.)+[a-z]{2,6}>?$/i), /** * @memberOf et2_url */