There are so many email verification functions written with PHP. But how many of them work perfect? In the search of perfect email verification with regular expression, the site fightingforalostcause.net has tested 13 of them and published the results at this page: Comparing E-mail Address Validating Regular Expressions. He found that Geert De Deckere from the Kohana project has the best one. Details are at the page above and here is the email verification function made of this regex.
/** * * @param$email * @return bool true if email is valid */ function validateEmail($email){ return (bool) preg_match('/^[-_a-z0-9\'+*$^&%=~!?{}]++(?:\.[-_a-z0-9\'+*$^&%=~!?{}]+)*+@(?:(?![-.])[-a-z0-9.]+(?<![-.])\.[a-z]{2,6}|\d{1,3}(?:\.\d{1,3}){3})(?::\d++)?$/iD', $email); }