PHP ~ validate email

if(eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email))
{
    print 'valid';
}
else
{
    print 'invalid';
}

http://www.totallyphp.co.uk/code/validate_an_email_address_using_regular_expressions.htm

沒有留言:

發佈留言