note 11323 added to ereg
| From: | dillybar1 at black-hole dot com | Date: | Fri, 16 Feb 2001 07:37:29 +0000 |
| Subject: | note 11323 added to ereg | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-11132@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;
}
}
http://www.php.net/manual/en/function.ereg.php