/v (Unicode Sets)
What is /v (Unicode Sets)?
/v (Unicode Sets): An upgraded version of /u (ES2024) that also supports set operations on character classes — union, intersection, and difference. The v flag is a newer, stricter version of u in JavaScript, added in ES2024. It keeps all the Unicode behaviour and adds set operations inside character classes. You can now write [\p{L}--[a-z]] for letters except lowercase ASCII, or [\p{Script=Greek}&&\p{Letter}] for the overlap of two sets. It also supports properties of strings, such as \p{RGI_Emoji}, which matches complete emoji including those made from several code points.
Frequently asked questions about /v (Unicode Sets)
What should you keep in mind with /v (Unicode Sets)?
The stricter syntax means some characters must be escaped inside classes, so a pattern that worked with u may throw an error with v. Use v in new code that runs on current browsers and Node 20 or later. For validation rules that combine several Unicode categories, it replaces long, fragile lists of ranges with something you can read.
At a glance
| Category | Regex flags |
|---|---|
| Explained by | Reinier de la Parra |
| Updated |