Skip to content

Instantly share code, notes, and snippets.

@guyellis
Created May 1, 2014 16:34
Show Gist options
  • Save guyellis/11455744 to your computer and use it in GitHub Desktop.
Save guyellis/11455744 to your computer and use it in GitHub Desktop.
Allows a list of space,comma,semicolon,tab and newline delimited emails to be parsed into an array.
// Accepts a single paramater which is one or more emails separated
// by space,comma,semicolon,tab, or newline.
// Returns an array of tokens that should be emails
// Does not validate emails to see if they are well formed.
exports.parseEmails = function(emails) {
return emails.toLowerCase().split(/[\s,;\t\n]+/);
};
@OyebisiJemil
Copy link

Thanks for this, it solves my problem!

@belueg
Copy link

belueg commented Jan 4, 2021

Thank you!! Very useful

@alexcloudstar
Copy link

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment