Re: Valid email address syntax script?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Jm <frawst1@xxxxxxxxx>:
> 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@xxxxxxxxxx         | http://vermontbotanical.org

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux