|
Posted by Matthew Weier O'Phinney on 05/03/05 21:18
* Jm <frawst1@gmail.com>:
> Does anyone have a nice email address syntax checking script they'd
> like to share? Regular expression-based anyone? TIA.
I use the following regex:
preg_match('/[^@\s]+@([-a-z0-9]+\.)+[a-z]{2,}$/i', $email)
I believe I got it out of the PHP Cookbook, by David Sklar, but I can't
remember for certain. It's not 100% accurate, but I rarely have
complaints from users whose emails don't validate.
--
Matthew Weier O'Phinney | WEBSITES:
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org
mailto:matthew@garden.org | http://vermontbotanical.org
Navigation:
[Reply to this message]
|