Skip to content

Instantly share code, notes, and snippets.

@pketh
Created March 9, 2015 15:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pketh/a585225c19aa58b5759f to your computer and use it in GitHub Desktop.
Save pketh/a585225c19aa58b5759f to your computer and use it in GitHub Desktop.
basic email validation
function isValidEmail(input) {
var trimmedInput = $.trim(input),
hasSpaces = trimmedInput.indexOf(' ') !== -1, // true if no spaces
matchesBasicEmailPattern = trimmedInput.match(/@.*[.]/);
return matchesBasicEmailPattern && !hasSpaces;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment