Change email regex to allow email addresses of the form "Ralf Becker <rb@stylite.de"

This commit is contained in:
Nathan Gray 2014-10-07 22:27:27 +00:00
parent af522ab692
commit 7111e0bb83
2 changed files with 4 additions and 2 deletions

View File

@ -25,6 +25,7 @@ class etemplate_widget_url extends etemplate_widget
* + "<rb@stylite.de>" or "rb@stylite.de"
* + '"Becker, Ralf" <rb@stylite.de>'
* + "'Becker, Ralf' <rb@stylite.de>"
* + "Ralf Becker <rb@stylite.de"
* but NOT:
* - "Becker, Ralf <rb@stylite.de>" (contains comma outside " or ' enclosed block)
* - "Becker < Ralf <rb@stylite.de>" (contains < ----------- " ---------------)
@ -33,7 +34,7 @@ class etemplate_widget_url extends etemplate_widget
*
* Same preg is in et2_widget_url Javascript class, but no \x00 allowed and /u modifier for utf8!
*/
const EMAIL_PREG = "/^(([^\042',<][^,<]+|\042[^\042]+\042|\'[^\']+\'|)\s?<)?[^\x01-\x20()<>@,;:\042\[\]]+@([a-z0-9ÄÖÜäöüß](|[a-z0-9ÄÖÜäöüß_-]*[a-z0-9ÄÖÜäöüß])\.)+[a-z]{2,6}>?$/iu";
const EMAIL_PREG = "/^(([^\042',<][^,<]+|\042[^\042]+\042|\'[^\']+\'|\042[^\042]+)\s?<)?[^\x00-\x20()<>@,;:\042\[\]]+@([a-z0-9ÄÖÜäöüß](|[a-z0-9ÄÖÜäöüß_-]*[a-z0-9ÄÖÜäöüß])\.)+[a-z]{2,6}>?\042?$/iu";
/**
* Validate input

View File

@ -38,6 +38,7 @@ var et2_url = et2_textbox.extend(
* + "<rb@stylite.de>" or "rb@stylite.de"
* + '"Becker, Ralf" <rb@stylite.de>'
* + "'Becker, Ralf' <rb@stylite.de>"
* + "Ralf Becker <rb@stylite.de"
* but NOT:
* - "Becker, Ralf <rb@stylite.de>" (contains comma outside " or ' enclosed block)
* - "Becker < Ralf <rb@stylite.de>" (contains < ----------- " ---------------)
@ -48,7 +49,7 @@ var et2_url = et2_textbox.extend(
*
* 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),
EMAIL_PREG: new RegExp(/^(([^\042',<][^,<]+|\042[^\042]+\042|\'[^\']+\'|\042[^\042]+)\s?<)?[^\x00-\x20()<>@,;:\042\[\]]+@([a-z0-9ÄÖÜäöüß](|[a-z0-9ÄÖÜäöüß_-]*[a-z0-9ÄÖÜäöüß])\.)+[a-z]{2,6}>?\042?$/i),
/**
* @memberOf et2_url
*/