Skip to content

Instantly share code, notes, and snippets.

@kharmabum
Created July 24, 2013 21:48
Show Gist options
  • Save kharmabum/6074889 to your computer and use it in GitHub Desktop.
Save kharmabum/6074889 to your computer and use it in GitHub Desktop.
validate email address in javascript
emailValid: function(email) {
// see: http://stackoverflow.com/questions/46155/validate-email-address-in-javascript
var re;
re = /^[a-zA-Z0-9!#$%&'*+\/=?\^_`{|}~\-]+(?:\.[a-zA-Z0-9!#$%&'\*+\/=?\^_`{|}~\-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/;
return re.test(email);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment