[pmwiki-devel] email verification regex question

Hans design5 at softflow.co.uk
Tue Oct 16 12:55:37 CDT 2007


I like to ask the regex experts if I got a regex right, to be
used for email verification.
The email form field gets checked with preg_match against this
pattern:
"/^([\w+*!%&`^~$=/|{}-][.]?)+[\w+*!%&`^~$=/|{}-]+@[\w.-]+\.[a-zA-Z]{2,4}$/i"

This still will not catch any local part provided as a quoted string,
which is apparently allowed for email addresses, but not much used.
It shall allow alphanumeric and a number of special characters
     _+*!%&`^~$=/|{}-
in the local part, and prohibit dots at the beginning or the end of
the local part, and repeated dots in the middle.
it will also not catch any entries like:

  Some Name <abcd.efgh at example.com> bla bla
  
I am not sure if this important or should be allowed as field entry.
Or can this be achieved simply by omitting the  ^ $ beginning and end
markers?
At least it should catch any straight addresses without spaces.
  

 Hans




More information about the pmwiki-devel mailing list