RegExp /u Flag
Examples
const text = "䷀";
const pattern = /\u{04DC0}/u;
let result = pattern.test(text);
Try it Yourself »
const text = "䷀";
const pattern = /\u{04DC0}/;
let result = pattern.test(text);
Try it Yourself »
Description
The /u (unicode) flag enables full Unicode support in the regular expression.
By default, JavaScript RegExp treats 4-byte Unicode characters (like emojis or less common symbols) as two separate 2-byte "surrogate" code units.
The /u flag treats the pattern as a sequence of Unicode code points, which is important for correctly handling of characters outside the Basic Multilingual Plane (BMP).
Note
JavaScript 2025 introduced the /v flag as an "upgrade" to the /u flag.
The /v Flag (unicodeSets) enables more Unicode-related features.
Syntax
new RegExp("regexp", "u")
or simply:
/regexp/u
See Also:
The Corresponding Property: unicode
Regular Expression Methods
Regular Expression Search and Replace can be done with different methods.
These are the most common:
String Methods
| Method | Description | 
|---|---|
| match(regex) | Returns an Array of results | 
| matchAll(regex) | Returns an Iterator of results | 
| replace(regex) | Returns a new String | 
| replaceAll(regex) | Returns a new String | 
| search(regex) | Returns the index of the first match | 
| split(regex) | Returns an Array of results | 
RegExp Methods
| Method | Description | 
|---|---|
| regex.exec() | Returns an Iterator of results | 
| regex.test() | Returns true or false | 
Browser Support
/regexp/u is an ECMAScript6 (ES6 2015) feature.
JavaScript 2015 is supported in all browsers since June 2017:
| Chrome 51 | Edge 15 | Firefox 54 | Safari 10 | Opera 38 | 
| May 2016 | Apr 2017 | Jun 2017 | Sep 2016 | Jun 2016 | 
 
