Skip to content

Instantly share code, notes, and snippets.

@anunay
Last active July 25, 2016 04:51
Show Gist options
  • Save anunay/5308388 to your computer and use it in GitHub Desktop.
Save anunay/5308388 to your computer and use it in GitHub Desktop.
Javascript: Email Validator
/**
* function validateEmail(email){}
* @author Anunay Dahal
* @param String email [Email address as a parameter]
* @return Boolean [Returns TRUE if email address is valid else return FALSE]
*/
function validateEmail(email){
return /^([\w!.%+\-])+@([\w\-])+(?:\.[\w\-]+)+$/.test(email);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment