In JavaScript, regex.unicodeSets is a read-only boolean. It is true when the RegExp was created with the v flag.
The v flag is a newer Unicode mode. It improves character classes (sets) and implies Unicode matching. Prefer v when you need set syntax; otherwise u is enough for most Unicode work.
Syntax
Create the regex with v, then read .unicodeSets.
JavaScript
const a = /a/;
const b = /a/v;
const c = new RegExp("a", "v");
console.log(a.unicodeSets); // false
console.log(b.unicodeSets); // true
console.log(c.unicodeSets); // true
Call
What it does
/a/v
Unicode sets mode. unicodeSets is true.
/[\p{Number}]/v
Example of a property escape in v mode (when supported).
new RegExp("a", "v")
Same as the literal with v.
Remember this at a glance:
Remember
/a/.unicodeSets → false
/a/v.unicodeSets → true
v → Unicode sets mode (includes Unicode behavior)
u → classic Unicode mode
you cannot use u and v together on one regex
What You Get
Name
Description
regex.unicodeSets
Read-only. true if the v flag was set when the RegExp was created.
v flag
Set at creation with /…/v or new RegExp(pattern, "v").
vs u
v replaces u for set-focused Unicode features. Do not combine u and v.
Return Value
Value
Description
true
The RegExp has the v (unicodeSets) flag.
false
The RegExp does not have the v flag.
JavaScript Examples
Example 1 — Read unicodeSets
See how the v flag sets the property.
JavaScript
const a = /x/;
const b = /x/v;
const c = new RegExp("x", "v");
console.log(a.unicodeSets);
console.log(b.unicodeSets);
console.log(c.unicodeSets);
console.log(c.flags);