Skip to content

Instantly share code, notes, and snippets.

@juanbrujo
Created August 29, 2019 15:21
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 juanbrujo/f14a98b810b4111b9003fcbbd6e9ea0f to your computer and use it in GitHub Desktop.
Save juanbrujo/f14a98b810b4111b9003fcbbd6e9ea0f to your computer and use it in GitHub Desktop.
Regex to check if email is valid for a Vue.js method.
checkEmail: function (email) {
// eslint-disable-next-line
const reg = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
if (reg.test(email)) return false
return true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment