Forums / Developer / e-mail validation - are you serious??

e-mail validation - are you serious??

Author Message

Thomas Brandl

Friday 26 September 2003 5:42:29 am

ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.'@'.'[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.'[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $address) );

this allows quite everything, @ and . given!

I think that comes much closer (and simpler!), but likely to be improved. Comments welcome (preg):
^[a-z0-9][-._a-z0-9]*@(?:[a-z0-9][-_a-z0-9]*\.)+[a-z]{2,4}$

Paul Borgermans

Friday 26 September 2003 7:44:15 am

Yeah

But email urls like mailto:thomas@somewhere.com?subject=You%20love%20preg
should also be possible

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans