1. License
“Permission is hereby granted, free of charge, to any person obtaining a copy of this software”
MIT allows commercial use; keep the copyright and license notice with the code.
github.com/mathiasbynens/emoji-regex/blob/main/LICENSE-MIT.txt2. Maintained
github.com/mathiasbynens/emoji-regex3. Used by agents' projects
Dependency in 2 public GitHub projects set up for AI coding agents that we scanned (0.0%).
4. Agent access
Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.
From the package registry and GitHub, checked daily; card checked Nov 10, 2026. Tap a verdict to see its source.How we checkedReport an error
What emoji-regex does
emoji-regex is a free JavaScript helper that finds every emoji in a text, including emoji built from several parts, like skin tones, families and flags. Your site or app can count emoji, remove them, or swap each one for your own picture. Each release follows the newest Unicode emoji list of its day, so update it when new emoji come out.
What people build with it
Find and count emoji in messages
A chat, comment box or review form finds the emoji in what people type, for example to count them or show them in a list.
Swap emoji for your own pictures
Show every emoji in your app's own emoji art, so it looks the same on every phone and computer.
Keep skin tones and families whole
An emoji with a skin tone, a family or a flag is several characters inside, but it is found as one emoji.
Strip emoji from names and links Idea
Remove emoji from a username, a file name or a page address before you save it, and keep the words.
Big emoji for emoji-only messages Idea
When a message is only emoji, like a party popper twice, show it larger, the way many chat apps do.
Limit emoji in profile names Idea
Allow at most two emoji in a display name or a product title, and ask the person to shorten it otherwise.
emoji-regex popularity
Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated
How emoji-regex is used
- emoji-regex is a dependency in 2 of the 6,258 public GitHub projects set up for AI coding agents that we scanned, too few to describe it from them alone. Our scan also samples projects by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750); counting those, it appears in 58 projects, and what it is used with below comes from all of them.
- Projects that use it most often also use chalk (93.1%), Axios (86.2%), lru-cache (86.2%).
Often used with
More about emoji-regex
Alternatives
emoji-regex This page
Pick the emoji library when your code is Python rather than JavaScript.
Get started
Tell your AI assistant
“Use the npm package emoji-regex (pin emoji-regex@11.0.0, import it as an ES module) to find, count or remove emoji in user text; call emojiRegex() for each new search instead of reusing one regex with .test().”
Add the package to your JavaScript project.
npm install emoji-regexFrom github.com/mathiasbynens/emoji-regex/blob/main/README.md
Import it and call it to get a fresh regular expression, then loop over the matches.
import emojiRegex from 'emoji-regex'; const regex = emojiRegex(); for (const match of text.matchAll(regex)) { const emoji = match[0]; console.log(`Matched sequence ${emoji} — code points: ${[...emoji].length}`); }From github.com/mathiasbynens/emoji-regex/blob/main/README.md
Mistakes to avoid
The regex has the g flag, so test() moves lastIndex; in our run the same object gave true, then false for the same rocket emoji.
10.6.0 shipped index.js for require and its README used require; 11.0.0 ships only index.mjs and the README switched to import.
Text-style signs count as emoji; in our run "© 2026 Acme™" became "2026 Acme".
One emoji can be several code points; in our run "Ship it 🚀🚀 thanks 👩🏿💻!" had length 28 and 3 emoji.
Each version only knows the emoji of its Unicode release.
Questions
Why is it a function and not a ready regular expression?
The pattern has the global flag, so each call returns a fresh copy that your code cannot change by accident.
Does a skin-tone emoji count as one or two?
As one match, even though it is two code points inside.
Can I use it in a paid product?
Yes, it is under the MIT license.
Will it find emoji added after its release?
No. Each version follows the Unicode release of its day; update the package when new emoji come out.