Last Updated: February 25, 2016
·
458
· mrebola

PHP Email Validation REGEX

$string = "first.last@domain.com.mx";
if (pregmatch(
'/^[^\W][a-zA-Z0-9_]+(.[a-zA-Z0-9
]+)\@[a-zA-Z0-9]+(.[a-zA-Z0-9]+).[a-zA-Z]{2,4}$/',$string)){
echo "example 3 successful.";
}

2 Responses
Add your response

filtervar($email, FILTERVALIDATE_EMAIL) is all you need

over 1 year ago ·

Hey Tom!, you are right , but thats just for PHP 5 , its cool, but I did it this way just to play a little bit with REGEX :D

over 1 year ago ·