Looking for a definitive email regular expression?
Here you have a regular expression to validate an email with no delimiters warnings
For this array test there are only three valid email adresses
$data=array( "NotAnEmail", "@NotAnEmail", "test\blah@example.com", "\"test\\\rblah\"@example.com", "\"test\rblah\"@example.com", "customer/department@example.com", "&A12345@example.com", "!def!xyz%abc@example.com", "_Yosemite.Sam@example.com", "~@example.com", ".wooly@example.com", "wo..oly@example.com", "pootietang.@example.com", ".@example.com", "Austin@Powers\"@example.com", "p.c.i.@example.fr", "p.c.i@example.fr", "ImaFool.@example.com", "Ima.Fool@example.com", "ima.fool@example.com", "Ima Fool@example.com" ); // Regular expression pattern with no warnings $pattern='/^[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\.-][a-z0-9]+)*)+\\.[a-z]{2,}$/i'; foreach($data as $email) { if(!preg_match($pattern,$email)) { echo "\n ".$email." => is NOT valid"; } }
This will print out 18 non valid email addresses. The validation is only for the format, chacking that the email format is valid only and not if the address exists