emoji-regex supplies a regex that matches emoji symbols and sequences per the Unicode Standard. It is published as an npm package for Node.js and bundlers.
Overview
emoji-regex provides a generated regular expression that matches emoji symbols and sequences, including textual emoji representations, according to the Unicode Standard. Patterns are built using emoji-test-regex-pattern at release time so updates can track new Unicode emoji assignments.
Each release ties to the Unicode version current when it shipped, yielding deterministic match results. That predictability matters when every matched emoji must map to a known image asset or downstream processing step. A sibling package, emoji-regex-xs, offers a lighter pattern with the same API when strict determinism is not required.
Consumers import a factory function that returns the regex so the global flag cannot be mutated accidentally on a shared pattern. Typical usage iterates matchAll over text to inspect each emoji sequence and its code-point length.
Installation is through npm for use in Node.js projects or any JavaScript toolchain that resolves npm dependencies.
Key features
- Unicode Standard-aligned emoji pattern
- Build-time pattern from emoji-test-regex-pattern
- Factory export prevents regex mutation
- Deterministic matching per release Unicode version
- Related lighter emoji-regex-xs package
- npm distribution for JavaScript runtimes
Use cases
- Splitting or counting emoji in user text
- Replacing emoji with image placeholders
- Validating emoji-only input fields
- Tokenizing messages for chat or social apps