Skip to content

Instantly share code, notes, and snippets.

@tracend
Last active January 23, 2017 20:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tracend/7763827 to your computer and use it in GitHub Desktop.
Save tracend/7763827 to your computer and use it in GitHub Desktop.
Underscore helper - checkif a string is a valid email
// isEmail underscore helper
// source: https://gist.github.com/tracend/7763827
_.mixin({
isEmail: function( email ){
var format = /^[a-zA-Z0-9\-_]+(\.[a-zA-Z0-9\-_]+)*@[a-z0-9]+(\-[a-z0-9]+)*(\.[a-z0-9]+(\-[a-z0-9]+)*)*\.[a-z]{2,4}$/;
return (email.match(format));
}
});
@qinbx
Copy link

qinbx commented Nov 13, 2015

Hi,
Seems above not works for new .marketing domain email address.
Eg: test@test.marketing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment