Every character in a JavaScript string has a numeric Unicode code point. The \uXXXX escape lets you refer to that character using exactly four hexadecimal digits after \u—both in string literals and inside regular expressions.
This is especially useful when the character is hard to type, invisible on your keyboard, or when you want your source code to stay ASCII-only while still matching international text, symbols, or control characters by their exact code point.
Three escape forms for matching characters by numeric value.
Unicode (4 hex)
\uXXXX
U+0000 to U+FFFF
Hex byte (2 hex)
\xHH
0x00 to 0xFF only
Braced Unicode
\u{1F600}
Any code point + u flag
Literal char
/é/
Same as \u00E9
Hands-On
Examples Gallery
Open DevTools Console (F12) or use Try-it links. Examples cover basic matching, symbols, accented letters, heart characters, and Unicode character classes.
📚 Getting Started
Match a letter by its Unicode code point.
Example 1 — Match the Letter A with \u0041
Return true when the string contains the character at U+0041.
JavaScript
console.log(/\u0041/.test("A")); // true
console.log(/\u0041/.test("B")); // false
console.log(/\u0041/.test("Apple")); // true (starts with A)
\u0041 is the Unicode code point for capital A. The regex engine converts the escape to that character before matching, so /\u0041/ behaves exactly like /A/.
📈 Practical Patterns
Match symbols, accented text, and Unicode character sets.
Look up code points at the Unicode Character Database or browser DevTools string inspector.
Compatibility
Browser & Runtime Support
The \uXXXX Unicode escape is part of core JavaScript regular expression syntax.
✓ Baseline · ES3+
RegExp \uXXXX
Supported in every browser and Node.js version. \u followed by four hex digits matches that Unicode code unit.
99%Universal syntax
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Full support
\uXXXXExcellent
Bottom line: Safe everywhere. Use \uXXXX when you need a specific Unicode character without typing it literally.
Wrap Up
Conclusion
The \uXXXX metacharacter matches a Unicode character by its four-digit hexadecimal code point. It is the standard way to reference letters, symbols, and accented characters in ASCII-safe regex patterns.
Exactly four. \u0041 is valid; \u41 (too few) and \u00441 (too many) are syntax errors in both string literals and regex patterns.
\xHH uses two hex digits and matches a byte value (0–255). \uXXXX uses four hex digits and matches any BMP code unit from U+0000 to U+FFFF, covering most letters, symbols, and accented characters.
Not directly with a single four-digit escape for code points above U+FFFF. Emoji require either a surrogate pair (two \u escapes) or the braced form \u{1F600} with the u flag on the regex.
The four-digit \uXXXX form works the same with or without the u flag. The u flag additionally enables the braced \u{...} syntax for any Unicode code point, including emoji.
The \uXXXX escape is core JavaScript syntax since ES3. It works in every modern browser and Node.js version without extra flags.
Did you know?
The escape \u0041 in a regex is the same value as typing A directly—but using the code point makes your pattern portable across editors and keyboard layouts that may not have easy access to international characters.