Advertisement

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.

The pattern
[#*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

Test it: match & no-match examples

Every row is loaded straight into the tester — click Try to see the match live:

InputResultWhy
deploy finished 🚀Matchunanchored scan finds it mid-sentenceTry →
made with ❤️ loveMatchdingbat range covers it, variation selector ignoredTry →
family 👨‍👩‍👧‍👦 photoMatchZWJ sequence detected from its four base emojiTry →
team 🇮🇩 and keycap 1️⃣Matchregional-indicator flag and keycap branch both fireTry →
plain ASCII text hereNo matchno emoji code points at allTry →
temperature 25°C is not a pictureNo match° is a sign, not an emojiTry →

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

Test this pattern on your own data
Paste it into the free tester with your real strings — nothing leaves your browser.
Open the regex tester →

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.

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.