http://qs1969.pair.com?node_id=125386


in reply to Re: Email Validation
in thread Email Validation

This regex fails for many valid addresses and it will pass on some invalid ones. Try:
postmaster@localhost (valid) @@domain.com (invalid) "my name" <myaddress@mydomain.com> (valid) "my name with spaces"@mydomain.com (valid) me@--.com (invalid)
This checks to make sure it has a @, has text before the @, text after the @, and a . after the @, and checks to make sure it is only alphanumeric charactors and no spaces
This is not the correct definition of a valid email address. Check RFC822 for the full specification.

For me, the best method is to try sending an email to the address. If you don't want to do that then I'd follow the advice of the other posters, who suggest Mastering Regular Expressions, Email::Valid / RFC::RFC822::Address / Mail::Address or others.

Update: I would also look at the FAQ: How do I check a valid mail address?

Simon Flack ($code or die)
$,=reverse'"ro_';s,$,\$,;s,$,lc ref sub{},e;$,
=~y'_"' ';eval"die";print $_,lc substr$@,0,3;