Gathering detailed insights and metrics for emoji-regex
Gathering detailed insights and metrics for emoji-regex
A regular expression to match all Emoji-only symbols as per the Unicode Standard.
npm install emoji-regex
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
17,305,152,972
Last Day
24,695,209
Last Week
114,135,268
Last Month
505,720,982
Last Year
5,733,963,867
1,787 Stars
112 Commits
173 Forks
22 Watching
2 Branches
20 Contributors
Minified
Minified + Gzipped
Latest Version
10.4.0
Package Id
emoji-regex@10.4.0
Unpacked Size
31.24 kB
Size
5.33 kB
File Count
6
NPM Version
10.7.0
Node Version
18.20.4
Publised On
26 Aug 2024
Cumulative downloads
Total Downloads
Last day
-3.3%
24,695,209
Compared to previous day
Last week
-14.3%
114,135,268
Compared to previous week
Last month
5.7%
505,720,982
Compared to previous month
Last year
38%
5,733,963,867
Compared to previous year
3
emoji-regex offers a regular expression to match all emoji symbols and sequences (including textual representations of emoji) as per the Unicode Standard. It’s based on emoji-test-regex-pattern, which generates (at build time) the regular expression pattern based on the Unicode Standard. As a result, emoji-regex can easily be updated whenever new emoji are added to Unicode.
Since each version of emoji-regex is tied to the latest Unicode version at the time of release, results are deterministic. This is important for use cases like image replacement, where you want to guarantee that an image asset is available for every possibly matched emoji. If you don’t need a deterministic regex, a lighter-weight, general emoji pattern is available via the emoji-regex-xs package that follows the same API.
Via npm:
1npm install emoji-regex
In Node.js:
1const emojiRegex = require('emoji-regex'); 2// Note: because the regular expression has the global flag set, this module 3// exports a function that returns the regex rather than exporting the regular 4// expression itself, to make it impossible to (accidentally) mutate the 5// original regular expression. 6 7const text = ` 8\u{231A}: ⌚ default emoji presentation character (Emoji_Presentation) 9\u{2194}\u{FE0F}: ↔️ default text presentation character rendered as emoji 10\u{1F469}: 👩 emoji modifier base (Emoji_Modifier_Base) 11\u{1F469}\u{1F3FF}: 👩🏿 emoji modifier base followed by a modifier 12`; 13 14const regex = emojiRegex(); 15for (const match of text.matchAll(regex)) { 16 const emoji = match[0]; 17 console.log(`Matched sequence ${ emoji } — code points: ${ [...emoji].length }`); 18}
Console output:
Matched sequence ⌚ — code points: 1
Matched sequence ⌚ — code points: 1
Matched sequence ↔️ — code points: 2
Matched sequence ↔️ — code points: 2
Matched sequence 👩 — code points: 1
Matched sequence 👩 — code points: 1
Matched sequence 👩🏿 — code points: 2
Matched sequence 👩🏿 — code points: 2
Update emoji-test-regex-pattern as described in its repository.
Bump the emoji-test-regex-pattern dependency to the latest version.
Update the Unicode data dependency in package.json
by running the following commands:
1# Example: updating from Unicode v13 to Unicode v14. 2npm uninstall @unicode/unicode-13.0.0 3npm install @unicode/unicode-14.0.0 --save-dev
Generate the new output:
1npm run build
Verify that tests still pass:
1npm test
On the main
branch, bump the emoji-regex version number in package.json
:
1npm version patch -m 'Release v%s'
Instead of patch
, use minor
or major
as needed.
Note that this produces a Git commit + tag.
Push the release commit and tag:
1git push && git push --tags
Our CI then automatically publishes the new release to npm.
Mathias Bynens |
emoji-regex is available under the MIT license.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 5/30 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More