Last active
March 27, 2019 13:30
-
-
Save Chuloo/a6d3eff461b68a173889377b949e2a66 to your computer and use it in GitHub Desktop.
Fetch emails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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