Created
May 3, 2011 19:09
-
-
Save josedaniel/953993 to your computer and use it in GitHub Desktop.
Function to validate an email addres
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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