JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 30576
  • Score
    100M100P100Q139956F
  • License MIT

Regular expression for matching email addresses

Package Exports

  • email-regex

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (email-regex) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

email-regex Build Status

Regular expression for matching email addresses

Use it for finding email addresses or checking if something is email like.

You shouldn't use this for validating emails. Only for hinting to the user.

Install

$ npm install email-regex

Usage

const emailRegex = require('email-regex');

// Contains an email address
emailRegex().test('unicorn sindresorhus@gmail.com');
//=> true

// Is an email address
emailRegex({exact: true}).test('sindresorhus@gmail.com');
//=> true

'unicorn sindresorhus@gmail.com cake john@doe.com rainbow'.match(emailRegex());
//=> ['sindresorhus@gmail.com', 'john@doe.com']

API

emailRegex([options])

Returns a regex for matching email addresses.

options

exact

Type: boolean
Default: false (Matches any email address in a string)

Only match an exact string.
Useful with RegExp#test to check if a string is an email address.

License

MIT © Sindre Sorhus