[thelist] regex for email check
Andrew Baio
andy at kickmedia.com
Mon Jan 1 01:44:08 CST 2001
At 11:03 PM 12/31/00, Adrian Fischer wrote:
>I know but does anyone have a down and dirty check for things like "@" and
>"." in an email . Im assuming it would be something like this:
First off, Happy New Year everybody!
Second, I found this down-and-dirty regex
on the web. The Perl cookbook was really
unhelpful here, saying that there's no
good way to validate e-mail. Whatever.
This is as good as any.
sub CheckEmailAddress() {
$_[0] =~ /[ |\t|\r|\n]*\"?([^\"]+\"?@[^ <>\t]+\.[^ <>\t][^
<>\t]+)[|\t|\r|\n]*/;
return $1;
}
Here's the webpage:
http://www.dundee.net/lyris/help/HowdoIvalidateEmailAddressesinmyPerlprograms_.html
-- Andy.
More information about the thelist
mailing list