Skip to content

Instantly share code, notes, and snippets.

@jtribble
Last active September 23, 2015 02:20
Show Gist options
  • Save jtribble/04569cf0e7a48a22bd9a to your computer and use it in GitHub Desktop.
Save jtribble/04569cf0e7a48a22bd9a to your computer and use it in GitHub Desktop.
/**
* Is string a valid email address?
*
* @param {string} str
* @return {boolean}
*/
var validEmail = function (str) {
var re = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
return re.test(str);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment