Skip to content
Agents tracked: 506 Releases (7d): 634 Agent status: 3 with issuesSince last limit reset: Claude 15d · Codex 0d For AI agents: Markdown Updated Nov 26, 2026

emoji-regex

Find every emoji in a piece of text.

UtilitiesNPM

GitHubWebsite

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.txt

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

62 / 100
Gid Score, #906 overall
612M
downloads a week, npm
1,909
GitHub stars
2
agent projects use it
emoji-regex: downloads per weeknpm, emoji-regex 612,019,069
emoji-regex: GitHub starsmathiasbynens/emoji-regex 1,909

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

In 93.1% of its projects
In 86.2% of its projects
In 86.2% of its projects
In 86.2% of its projects
In 84.5% of its projects
In 84.5% of its projects
In 84.5% of its projects

More about emoji-regex

More in Utilities

Alternatives

emoji-regex This page

MITGid 62612M/wk

emoji

Pick the emoji library when your code is Python rather than JavaScript.

Compare emoji-regex with another tool

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().”

  1. Add the package to your JavaScript project.

    npm install emoji-regex

    From github.com/mathiasbynens/emoji-regex/blob/main/README.md

  2. 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

const re = emojiRegex(); then re.test(a), re.test(b) ... with the same object
Call emojiRegex() for each test, or use s.match(...) / s.matchAll(emojiRegex())

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.

const emojiRegex = require('emoji-regex'); copied from older guides
import emojiRegex from 'emoji-regex'; or pin emoji-regex@10.6.0 if the project must stay on CommonJS

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.

s.replace(emojiRegex(), '') to clean a company name or legal text
Skip © ® ™ and similar signs yourself, or only strip matches that contain the emoji style marker U+FE0F

Text-style signs count as emoji; in our run "© 2026 Acme™" became "2026 Acme".

Counting emoji with text.length or [...text].length
Count the matches of text.matchAll(emojiRegex())

One emoji can be several code points; in our run "Ship it 🚀🚀 thanks 👩🏿‍💻!" had length 28 and 3 emoji.

Keeping an old emoji-regex version for years
Update it after each new Unicode emoji release (11.0.0 follows Unicode 18.0)

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.