Skip to content

Instantly share code, notes, and snippets.

@Chuloo
Last active March 27, 2019 13:30
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 Chuloo/a6d3eff461b68a173889377b949e2a66 to your computer and use it in GitHub Desktop.
Save Chuloo/a6d3eff461b68a173889377b949e2a66 to your computer and use it in GitHub Desktop.
Fetch emails
// Create a string
const email = 'hello@john.com is my email, but i also use sign@john.com or help@sweets.com';
// Create a regex to match all email
const re = /([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi;
// Find emails in string
const matches = email.match(re);
// Display output
console.log(matches)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment