JSPM

  • Created
  • Published
  • Downloads 168695502
  • Score
    100M100P100Q246443F
  • License MIT

A regular expression to match all Emoji-only symbols as per the Unicode Standard.

Package Exports

  • emoji-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 (emoji-regex) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

emoji-regex Build status Code coverage status Dependency status

emoji-regex offers a regular expression to match all Emoji-only symbols as per the Unicode Standard.

This repository contains a script that generates this regular expression based on the data from Unicode Technical Report #51. Because of this, the regular expression can easily be updated whenever new emoji are added to the Unicode standard.

Installation

Via npm:

npm install emoji-regex

In Node.js:

var emojiRegex = require('emoji-regex');
// Note: because the regular expression has the global flag set, this module
// exports a function that returns the regex rather than exporting the regular
// expression itself, to make it impossible to (accidentally) mutate the
// original regular expression.

emojiRegex().test('πŸ†˜');
// β†’ true
emojiRegex().test('πŸ’©');
// β†’ true
emojiRegex().test('πŸ‡ΎπŸ‡ͺ');
// β†’ true

var flag = 'πŸ‡ΎπŸ‡ͺ'; // flag for Yemen
flag.match(emojiRegex())[0] == flag;
// β†’ true

Author

twitter/mathias
Mathias Bynens

License

emoji-regex is available under the MIT license.