note 11323 deleted from function.ereg by jimw
| From: | jimw@php.net | Date: | Fri, 02 Nov 2001 01:23:47 +0000 |
| Subject: | note 11323 deleted from function.ereg by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-20132@lists.php.net to get a copy of this message | ||
here is a VERY good email Perl email validation regex sub, shouldnt be hard to convert it to PHP:
sub ValidateEmail
{ my $email = shift;
if ($email =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/ ||
$email !~ /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/)
{
return 0;
}
else
{
return 1;
}
}