Skip to content

Instantly share code, notes, and snippets.

@josedaniel
Created May 3, 2011 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josedaniel/953993 to your computer and use it in GitHub Desktop.
Save josedaniel/953993 to your computer and use it in GitHub Desktop.
Function to validate an email addres
//FUNCTION TO VALIDATE AN EMAIL ADDRESS
//USAGE: Ej:, validate_email(josedaniel.paterninasoto@gmail.com);
//This will return TRUE if the email is valid or FALSE if not.
function validate_email(email){
if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)){
return(true);
}else{
return(false);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment