mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 16:48:49 +01:00
new regexp to validate email addresses plus examples what it should validate and what not
This commit is contained in:
parent
5810566450
commit
0b994ee837
@ -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 <rb@stylite.de>"
|
||||
* + "Ralf Becker (Stylite AG) <rb@stylite.de>"
|
||||
* + "<rb@stylite.de>" or "rb@stylite.de"
|
||||
* + '"Becker, Ralf" <rb@stylite.de>'
|
||||
* + "'Becker, Ralf' <rb@stylite.de>"
|
||||
* but NOT:
|
||||
* - "Becker, Ralf <rb@stylite.de>" (contains comma outside " or ' enclosed block)
|
||||
* - "Becker < Ralf <rb@stylite.de>" (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
|
||||
|
@ -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 <rb@stylite.de>"
|
||||
* + "Ralf Becker (Stylite AG) <rb@stylite.de>"
|
||||
* + "<rb@stylite.de>" or "rb@stylite.de"
|
||||
* + '"Becker, Ralf" <rb@stylite.de>'
|
||||
* + "'Becker, Ralf' <rb@stylite.de>"
|
||||
* but NOT:
|
||||
* - "Becker, Ralf <rb@stylite.de>" (contains comma outside " or ' enclosed block)
|
||||
* - "Becker < Ralf <rb@stylite.de>" (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
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user