Intent to ship: RegExp /v flag with set notation

30 views
Skip to first unread message

Daniel Minor

unread,
May 30, 2023, 1:25:03 PM5/30/23
to dev-pl...@mozilla.org
As of Firefox 115, we will support the /v flag ("Unicode Sets") in RegExps.

Use case:

This adds syntax and semantics for the following set operations:

difference/subtraction (in A but not in B)
intersection (in both A and B)
nested character classes (needed to enable the above)

along with some additional unicode properties.

An example from the proposal explainer, looking for “invisible characters” except for ASCII space:

[[\p{Other}\p{Separator}\p{White_Space}\p{Default_Ignorable_Code_Point}]--\x20]

The /v flag advanced to Stage 4 at the May 2023 meeting of TC39 and will be included in the next edition of the ES standard.

Bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=1713657

Standard:
https://github.com/tc39/proposal-regexp-v-flag

Platform coverage:
All, no pref

DevTools bug:
N/A

Other browsers:
V8 shipping in 112 <https://bugs.chromium.org/p/v8/issues/detail?id=11935>
JSC shipping in Safari Technology Preview 166 <https://bugs.webkit.org/show_bug.cgi?id=241593>

Testing:
There are test262 tests covering these features:
https://github.com/tc39/test262/tree/main/test/built-ins/RegExp/property-escapes/generated/strings
https://github.com/tc39/test262/tree/main/test/built-ins/RegExp/prototype/unicodeSets
https://github.com/tc39/test262/tree/main/test/built-ins/RegExp/unicodeSets/generated

Secure contexts:
This is a JS language feature and is therefore present in all contexts.
Reply all
Reply to author
Forward
0 new messages