RegExp v Modifier
Description
The v 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
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:
Example | Description |
---|---|
text.match(pattern) | The String method match() |
text.search(pattern) | The String method search() |
pattern.exec(text) | The RexExp method exec() |
pattern.test(text) | The RegExp method test() |
Browser Support
/regexp/v
is an ES2025 feature.
JavaScript 2025 is fully supported in all modern browsers since May 2025:
Chrome 135 | Edge 135 | Firefox 129 | Safari 18.2 | Opera 120 |
Apr 2025 | Apr 2025 | Aug 2024 | Des 2024 | May 2025 |