/ Published in: PHP
Completely replaced original regular expression with one that works much better.
Expand |
Embed | Plain Text
function validate_email($email) { return 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); }
Comments
Subscribe to comments
You need to login to post a comment.

.museum is a valid domain. Your regular expression should account for it. e.g. {2,6}
test
Function now supports the .museum domain (and other domains that are 6 letters long)