Last active
August 29, 2015 14:17
-
-
Save jayproulx/62bbd62cc23675d9918f to your computer and use it in GitHub Desktop.
Air Canada Email Validation
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
// http://help-aircanada.com/aircanada-help/js/aircanada_11112013.js | |
//This function is used to validate email address : Returns true if email is valid | |
function isEmailValid(emailToValidate){ | |
//var regex1=/^([_A-Za-z0-9-/&]+(\.[_A-Za-z0-9-/&]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.(([A-Za-z]{2,3})|(aero|coop|info|museum)))?$/ | |
//return regex1.test(emailToValidate); | |
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,17})+$/.test(emailToValidate)) | |
{ | |
return (true); | |
} | |
alert(document.getElementById('invalidemail').value); | |
//.alert("Please Enter A Valid EmailAddress as ([email protected])"); | |
return (false) ; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Looks like the longest TLD is 17 characters http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains