Download Cheat sheet PDF 12 pages · syntax, editors, patterns, Unicode, performance, debugging
Pattern

Regex for Emoji (Unicode)

Match common Unicode emoji characters.

The Emoji (Unicode) regex is (?:[☀-➿]|\ud83c[\udf00-\udfff]|\ud83d[\udc00-\udfff]|\ud83e[\udd00-\uddff]) — copy it below, or open it in the explainer for a token-by-token breakdown.

The pattern

(?:[☀-➿]|\ud83c[\udf00-\udfff]|\ud83d[\udc00-\udfff]|\ud83e[\udd00-\uddff])
Try in explainer → Download cheat sheet ↓

What it matches

  • 🎉
  • 😀
  • 🚀

What it doesn't match

  • abc
  • :)
  • plain

Notes & gotchas

Requires the /u flag in JavaScript. Covers Miscellaneous Symbols, Dingbats, and the main Emoji blocks. Doesn't cover all emoji (skin tone modifiers, ZWJ sequences, flags) — for complete coverage use a Unicode library.

Code in your language

Use the explainer's Code tab to generate ready-to-paste snippets in JavaScript, Python, Java, .NET, Go, Ruby, and PHP for this pattern.

Open in explainer →

Token-by-token breakdown

Every part of the pattern, left to right:

TokenMeaning
(?:start of a non-capturing group
[☀-➿]any of: ☀–➿
|OR — try the alternative
\uescape \u
d83cliteral text “d83c”
[\udf00-\udfff]any of: “u”, “d”, “f”, “0”, 0–\
|OR — try the alternative
\uescape \u
d83dliteral text “d83d”
[\udc00-\udfff]any of: “u”, “d”, “c”, “0”, 0–\, “f”
|OR — try the alternative
\uescape \u
d83eliteral text “d83e”
[\udd00-\uddff]any of: “u”, “d”, “0”, 0–\, “f”
)end of group

About this pattern

Number patterns appear constantly in form validation, log parsing, and data extraction. Regex is great for matching the shape but limited for semantic checks (range validation, mathematical constraints).

Quick usage in different languages

This exact pattern — with the correct escaping and idioms for each language:

  • JavaScript: /(?:[☀-➿]|\ud83c[\udf00-\udfff]|\ud83d[\udc00-\udfff]|\ud83e[\udd00-\uddff])/.test(value)
  • Python: re.match(r"(?:[☀-➿]|\ud83c[\udf00-\udfff]|\ud83d[\udc00-\udfff]|\ud83e[\udd00-\uddff])", value)
  • Java: Pattern.compile("(?:[☀-➿]|\\ud83c[\\udf00-\\udfff]|\\ud83d[\\udc00-\\udfff]|\\ud83e[\\udd00-\\uddff])").matcher(value).matches()
  • C# / .NET: Regex.IsMatch(value, @"(?:[☀-➿]|\ud83c[\udf00-\udfff]|\ud83d[\udc00-\udfff]|\ud83e[\udd00-\uddff])")
  • Go: regexp.MustCompile(`(?:[☀-➿]|\ud83c[\udf00-\udfff]|\ud83d[\udc00-\udfff]|\ud83e[\udd00-\uddff])`).MatchString(value)
  • Ruby: /(?:[☀-➿]|\ud83c[\udf00-\udfff]|\ud83d[\udc00-\udfff]|\ud83e[\udd00-\uddff])/.match?(value)
  • PHP: preg_match('~(?:[☀-➿]|\ud83c[\udf00-\udfff]|\ud83d[\udc00-\udfff]|\ud83e[\udd00-\uddff])~', $value)

The explainer’s Code tab regenerates these for any pattern you paste, and the downloadable cheat sheet bundles the breakdown, all seven snippets, and the pitfalls below onto one printable page.

Common pitfalls

  • Not anchored. Without ^ and $ this can match a substring anywhere in the input — add anchors if you need the whole value to conform.
  • Validate beyond format. Matching the format doesn't guarantee the value is real. Confirm the emoji (unicode) against a source of truth (database, API, or checksum) where it matters.

Standards & sources

This pattern is based on the following authoritative specification(s) and issuing authorities. Formats can change — always confirm against the primary source.

Related patterns

More patterns in the Numbers & text category:

See also

Browse all 300 patterns in the library, or open this regex in the interactive explainer to see a token-by-token breakdown, test against custom input, and generate code in seven languages.


← Back to all patterns