Gathering detailed insights and metrics for emoji-regex
Gathering detailed insights and metrics for emoji-regex
Gathering detailed insights and metrics for emoji-regex
Gathering detailed insights and metrics for emoji-regex
astral-regex
Regular expression for matching astral symbols
emoji-regex-xs
A regular expression to match all emoji-only symbols
emojibase-regex
Evergreen emoji regex patterns.
@types/emoji-regex
Stub TypeScript definitions entry for emoji-regex, which provides its own types definitions
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
99.9
Supply Chain
100
Quality
79.2
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
19,971,512,812
Last Day
33,101,551
Last Week
174,683,442
Last Month
730,272,868
Last Year
6,739,430,573
MIT License
1,805 Stars
112 Commits
173 Forks
21 Watchers
2 Branches
20 Contributors
Updated on May 27, 2025
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
Published on
Aug 26, 2024
Cumulative downloads
Total Downloads
Last Day
-1.4%
33,101,551
Compared to previous day
Last Week
0%
174,683,442
Compared to previous week
Last Month
10.3%
730,272,868
Compared to previous month
Last Year
47.2%
6,739,430,573
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 1 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
project is not fuzzed
Details
Reason
security policy file not detected
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-05-19
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