Below are some examples of different methods and regex used to validate a email address.
Please note that the purpose of this function is not to be copy-pasted. Some cleaning will be needed based on your choice.
function ValidEmail($Email = NULL) { // original with problems -- don't use this one - it is just informative $regexp = "/^[^0-9][a-z0-9_]+([.][a-z0-9_\-]+)*[@][a-z0-9_\-]+([.][a-z0-9_\-]+)*[.][a-z]{2,4}$/"; // I like this one because is based on PHP native email validator // please note that there is a issue on php < 5.3.6 // https://bugs.php.net/bug.php?id=53091 if(filter_var($Email, FILTER_VALIDATE_EMAIL)) { return true; } else { return false; } // used on a website production, but it is not updated and should be if new TLD's will be added. // works good enough $regexp = "/^[a-z](([\.|_|\-|~|!|$|%|^|&|*|=|+]{0,1})[a-z0-9}{\'?]+)*@([a-z0-9_][-a-z0-9_]*(\.[-a-z0-9_]+)*\.(aero|arpa|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|mobi|[a-z]{2,3})|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,5})?$/i"; // new form net - it is more general // works ok $regexp = "/^([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,6})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)$/i"; if(!preg_match($regexp, $Email)) { return false; } else { return true; } } var_dump(ValidEmail("c.hutan.u@domain.ro")); var_dump(ValidEmail("c.hutanu.@domain.ro")); var_dump(ValidEmail("h.catalin_@domain.ro")); var_dump(ValidEmail("1h.catalin@domain.ro")); var_dump(ValidEmail("Ah.catalin@domain.ro")); var_dump(ValidEmail("c@domain.ro")); var_dump(ValidEmail("catalinh@domain.ro"));