Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ketanmistry/ef47087a7f5ad4815b50c65eebf4d823 to your computer and use it in GitHub Desktop.
Save ketanmistry/ef47087a7f5ad4815b50c65eebf4d823 to your computer and use it in GitHub Desktop.
jQuery: Validate Email with Regex
/* jQuery Validate Emails with Regex */
function validateEmail(Email) {
var pattern = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
return $.trim(Email).match(pattern) ? true : false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment