Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const extractEmails = (text) => {
- const match = text.match(/[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/gi);
- return match !== null ? match : [];
- }
- // text => 'first <first@mail.com>, second <second@mail.com> notamail.com bb@mail.com'
- // extractEmails(text) => ['first@mail.com', 'second@mail.com', 'bb@mail.com']
Add Comment
Please, Sign In to add comment