Skip to content

Instantly share code, notes, and snippets.

@wheresalice
Created October 25, 2011 07:48
Show Gist options
  • Save wheresalice/1311754 to your computer and use it in GitHub Desktop.
Save wheresalice/1311754 to your computer and use it in GitHub Desktop.
Replacement Drupal function for email validation
function valid_email_address($mail) {
return (bool)filter_var($mail,FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>"/^[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/")));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment