Created
September 11, 2014 15:41
-
-
Save khoand0000/29879b41b0b99c6932d1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$regex = "/([a-z0-9_]+|[a-z0-9_]+\.[a-z0-9_]+)@(([a-z0-9]|[a-z0-9]+\.[a-z0-9]+)+\.([a-z]{2,4}))/i"; | |
// usage | |
if(!preg_match($regex, $email)) { | |
echo "Invalid email address"; | |
} | |
else { | |
echo "email is valid"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment