RegExp /v Flag
Examples
let text = "Hello 😄";
let pattern = /\p{RGI_Emoji}/v;
let result = pattern.test(text);
Try it Yourself »
let text = "Hello 😄";
let pattern = /\p{RGI_Emoji}/;
let result = pattern.test(text);
Try it Yourself »
Description
The /v (unicodeSets) flag is an "upgrade" to the /u flag.
It enables more Unicode-related features.
The new features are:
- The \p escape sequence matches strings, instead of just characters.
- The character class is upgraded to allow intersection, union, and subtraction syntaxes, as well as matching multiple Unicode characters.
Note
Using both flags (/u and /v) results in a SyntaxError.
Syntax
new RegExp("regexp", "v")
or simply:
/regexp/v
See Also:
The Corresponding Property: unicodeSets
Regular Expression Search Methods
In JavaScript, a regular expression text search, can be done with different methods.
With a pattern as a regular expression, these are the most common methods:
String Methods
match(pattern) | An Array of results |
matchAll(pattern) | An Iterator of results |
replace(pattern, rep) | A new String |
search(pattern) | Index of the first match |
split(pattern) | An Array of results |
RegExp Methods
pattern.exec() | An Iterator of results |
pattern.test() | true or false |
Browser Support
/regexp/v
is a JavaScript 2025 feature.
ES 2025 is fully supported in all modern browsers since May 2025:
Chrome 136 | Edge 136 | Firefox 129 | Safari 18.2 | Opera 120 |
Apr 2025 | Apr 2025 | Aug 2024 | Des 2024 | May 2025 |