Skip to content

Instantly share code, notes, and snippets.

@alexsasharegan
Created August 23, 2016 05:41
Show Gist options
  • Save alexsasharegan/3525cfaec316ccfad537e9d16a46efb9 to your computer and use it in GitHub Desktop.
Save alexsasharegan/3525cfaec316ccfad537e9d16a46efb9 to your computer and use it in GitHub Desktop.
let emailRegEx = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
if (emailRegEx.test(email)) {
$email.removeClass('invalid').addClass('valid');
} else {
$email.removeClass('valid').addClass('invalid');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment