Pattern library / Strings & Text
Regex to Match Emoji in Text
Emoji look exotic, but they are code points on three Unicode planes, so a curated range list finds them anywhere in a string: 🚀 ✅ 🇮🇩 🪩 all hit the pattern below — and because a flag (two regional indicators), a ZWJ family like 👨👩👧👦, a skin-tone modifier or a keycap still contains a base emoji, every real sequence is detected too. The pattern has one job — does this text contain emoji — and it is unanchored, so one pass scans a whole sentence or log line. No lookaround, no backreferences: RE2-safe for GA4 and BigQuery. JavaScript needs the u flag, because astral ranges only exist in Unicode mode (see note 1); Python and RE2 take the pattern exactly as shown. Typical uses: username and mention cleanup, emoji-only-message detection, and keeping customer-facing fields emoji-free — all runnable live in the tester.
[#*0-9]\uFE0F?\u20E3|[\u00A9\u00AE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9-\u21AA\u231A-\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA-\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u26FF\u2700-\u27BF\u2934-\u2935\u2B05-\u2B07\u2B1B-\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|[🀄🃏🆎🆑-🆚🇦-🇿🈁-🈂🈚🈯🈲-🈶🈸-🈺🉐-🉑🌀-🗿😀-🙏🚀-🟠-🟫🤀-🧿🩰-🫸]Load this pattern into the tester →
How the pattern works
- JavaScript needs the
uflag: without it the class compiles as UTF-16 code units and an astral range like🌀-🗿throws Range out of order in character class. The tester’s Try links load this pattern withgu; in your own code write/.../u. Python and RE2/GA4 work on code points and need no flag. - Skin tones (
U+1F3FB–U+1F3FF) live inside the1F300-1F5FFrange, so👍🏽is detected from its base — and neither ZWJ (U+200D) nor the variation selector (U+FE0F) needs a branch of its own, because every sequence still carries at least one base emoji. They DO matter when you remove emoji — see FAQ 1. - Keycap branch
[#*0-9]\uFE0F?\u20E3: digits stay out of the main classes, so a bare1or#in your data never counts as emoji — only the full keycap sequence1️⃣does. - A curated range list, not the full Unicode property: it covers the emoji people actually ship — including modern ones like
🪩and🟠— but a few exotic or brand-new code points can slip through. For guaranteed completeness swap in\p{Extended_Pictographic}with theuflag (JavaScript) or extend the ranges from Unicode’s emoji-test.txt.
Test it: match & no-match examples
Every row is loaded straight into the tester — click Try to see the match live:
| Input | Result | Why | |
|---|---|---|---|
deploy finished 🚀 | Match | unanchored scan finds it mid-sentence | Try → |
made with ❤️ love | Match | dingbat range covers it, variation selector ignored | Try → |
family 👨👩👧👦 photo | Match | ZWJ sequence detected from its four base emoji | Try → |
team 🇮🇩 and keycap 1️⃣ | Match | regional-indicator flag and keycap branch both fire | Try → |
plain ASCII text here | No match | no emoji code points at all | Try → |
temperature 25°C is not a picture | No match | ° is a sign, not an emoji | Try → |
Where to use it
JavaScript
const re = /[#*0-9]\uFE0F?\u20E3|[\u00A9\u00AE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9-\u21AA\u231A-\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA-\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u26FF\u2700-\u27BF\u2934-\u2935\u2B05-\u2B07\u2B1B-\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|[🀄🃏🆎🆑-🆚🇦-🇿🈁-🈂🈚🈯🈲-🈶🈸-🈺🉐-🉑🌀-🗿😀-🙏🚀-🟠-🟫🤀-🧿🩰-🫸]/gu; // u flag is mandatory for astral ranges 'ship it 🚀 done'.match(re); // ['🚀'] 'no emoji here'.match(re); // null
Python
import re PAT = r'[#*0-9]\uFE0F?\u20E3|[\u00A9\u00AE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9-\u21AA\u231A-\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA-\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u26FF\u2700-\u27BF\u2934-\u2935\u2B05-\u2B07\u2B1B-\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|[🀄🃏🆎🆑-🆚🇦-🇿🈁-🈂🈚🈯🈲-🈶🈸-🈺🉐-🉑🌀-🗿😀-🙏🚀-🟠-🟫🤀-🧿🩰-🫸]' # no flag needed: code points, not UTF-16 re.findall(PAT, 'ship it 🚀 done') # ['🚀']
BigQuery / GA4 (RE2)
SELECT REGEXP_CONTAINS('ship it 🚀 done', r'[#*0-9]\uFE0F?\u20E3|[\u00A9\u00AE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9-\u21AA\u231A-\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA-\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u26FF\u2700-\u27BF\u2934-\u2935\u2B05-\u2B07\u2B1B-\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|[🀄🃏🆎🆑-🆚🇦-🇿🈁-🈂🈚🈯🈲-🈶🈸-🈺🉐-🉑🌀-🗿😀-🙏🚀-🟠-🟫🤀-🧿🩰-🫸]') AS has_emoji,
REGEXP_EXTRACT('hi 🇮🇩 flag', r'[#*0-9]\uFE0F?\u20E3|[\u00A9\u00AE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9-\u21AA\u231A-\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA-\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u26FF\u2700-\u27BF\u2934-\u2935\u2B05-\u2B07\u2B1B-\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|[🀄🃏🆎🆑-🆚🇦-🇿🈁-🈂🈚🈯🈲-🈶🈸-🈺🉐-🉑🌀-🗿😀-🙏🚀-🟠-🟫🤀-🧿🩰-🫸]') AS first_emoji
Common mistakes
- Dropping the
uflag in JavaScript is a hard error, not a silent miss:new RegExp('[🌀-🗿')throws Range out of order in character class, because non-Unicode JS classes work on UTF-16 code units. The same pattern compiles and matches fine in Python — that asymmetry is the number-one reason emoji regexes "work here, fail there". - Matches are not an emoji count: one emoji can yield several hits —
👨👩👧👦hits four times (one per base) and🇮🇩twice (regional indicators). When the number has to be right, count grapheme clusters (Intl.Segmenterin JS) instead of matches. ©,®and™are emoji code points, so a plain legal line like© 2026 RegexLabcounts as emoji-containing — correct per Unicode, rarely what you want. Delete\u00A9\u00AE\u2122from the class if you only care about pictures.
FAQ
How do I check that a string is only emoji?
Strip the matches and the invisible glue, then test the remainder: s.replace(EMOJI_RE, '').replace(/[\u200D\uFE0F\u20E3]/gu, '') === '. The second pass removes the ZWJ, variation selector and keycap marks that would otherwise be left standing between the emoji you deleted.
Why does my emoji regex fail in JavaScript but work in Python?
Unicode mode. Python and RE2 match on code points, so the literal ranges work as written; JavaScript without the u flag compiles a class as UTF-16 code units and rejects astral ranges outright. Add u (or, better, use \p{Extended_Pictographic} with u) and the same pattern works everywhere.
Can I use this in GA4 or BigQuery?
Yes — it is pure range syntax with no lookaround and no backreferences, so RE2 accepts it: SELECT REGEXP_CONTAINS(col, r'[#*0-9]\uFE0F?\u20E3|[\u00A9\u00AE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9-\u21AA\u231A-\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA-\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u26FF\u2700-\u27BF\u2934-\u2935\u2B05-\u2B07\u2B1B-\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|[🀄🃏🆎🆑-🆚🇦-🇿🈁-🈂🈚🈯🈲-🈶🈸-🈺🉐-🉑🌀-🗿😀-🙏🚀-🟠-🟫🤀-🧿🩰-🫸]'), or REGEXP_REPLACE(col, r'[#*0-9]\uFE0F?\u20E3|[\u00A9\u00AE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9-\u21AA\u231A-\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA-\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u26FF\u2700-\u27BF\u2934-\u2935\u2B05-\u2B07\u2B1B-\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|[🀄🃏🆎🆑-🆚🇦-🇿🈁-🈂🈚🈯🈲-🈶🈸-🈺🉐-🉑🌀-🗿😀-🙏🚀-🟠-🟫🤀-🧿🩰-🫸]', '') to strip emoji. In GA4, remember filters full-match by default — see GA4 match types if your pattern needs anchors or a partial-match surface.
Related patterns
Username Regex — Validate 3–20 Char Usernames · Hashtag Regex - Match #tags in Posts & Text · Mention Regex - Match @handles in Text
For GA4-specific patterns, see the GA4 regex cheat sheet, the page path regex guide, the event filter regex guide, the GA4 regex match types, the custom channel grouping guide and RE2 vs PCRE. Browse the full regex pattern library.