Skip to content

Instantly share code, notes, and snippets.

@Dottenpixel
Forked from argshook/matchEmail.js
Last active August 29, 2015 14:04
Show Gist options
  • Save Dottenpixel/3df3719bb27c3fe39b14 to your computer and use it in GitHub Desktop.
Save Dottenpixel/3df3719bb27c3fe39b14 to your computer and use it in GitHub Desktop.
// regexp for matching a valid email and populating an array with its parts
'[email protected]'.match(/([a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*)+\@([a-z0-9-]+)\.([a-z.]{2,})/)
// returns ['[email protected]', 'e.mail-address', 'my-domain', 'co.us']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment