Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

get-emails

sindresorhus6kMIT4.0.0TypeScript support: included

Get all email addresses in a string

get, extract, find, scrape, text, string, email, address, emails

readme

get-emails

Get all email addresses in a string

Install

$ npm install get-emails

Usage

import getEmails from 'get-emails';

const text = 'Lorem ipsum dolor, sindresorhus@gmail.com consectetuer unicorn@rainbow.cake elit.';

getEmails(text);
//=> Set {'sindresorhus@gmail.com', 'unicorn@rainbow.cake'}

If the string comes from user input, it's up to you to limit it to some reasonable length to prevent abuse.