| Flag (property) | Effect | Flag (property) | Effect |
|---|---|---|---|
| g (global) | find all matches | u (unicode) | code points, \p{…} (ES2015) |
| i (ignoreCase) | case-insensitive | v (unicodeSets) | u plus set operations (ES2024) |
| m (multiline) | ^ $ match at line breaks | y (sticky) | match only at lastIndex |
| s (dotAll) | . matches line breaks (ES2018) | d (hasIndices) | group positions (ES2022) |
The v flag upgrades u (never combine them): classes gain subtraction --, intersection && and nesting, and \p{RGI_Emoji} matches whole multi-code-point emoji. Inline modifiers (ES2025, Baseline since September 2025) turn i, m or s on, or off with -, inside one group: (?i:…), (?-i:…). The engine builds d's indices only on request because they cost time.
const m = /(?<word>\w+)/d.exec(' hello');
console.log(m.indices[0], m.indices.groups.word);
console.log(/[\p{L}--\p{ASCII}]/v.test('é'), /[\p{L}--\p{ASCII}]/v.test('e'));
console.log(/^\p{RGI_Emoji}$/v.test('👍🏽'), /^\p{Emoji}$/u.test('👍🏽'));
const hello = /^Hello (?i:world)!$/; // i applies inside the group only
console.log(hello.test('Hello WORLD!'), hello.test('HELLO world!'));[ 2, 7 ] [ 2, 7 ] true false true false true false