Intent to Ship: RegExp modifiers

576 views
Skip to first unread message

Shu-yu Guo

unread,
Mar 27, 2024, 11:39:04 AMMar 27
to blink-dev

Contact emails

s...@chromium.orgpth...@chromium.org

Explainer

None

Specification

https://tc39.es/proposal-regexp-modifiers

Summary

RegExp modifiers adds the ability to locally modify the 'i', 'm', and 's' flags inside a pattern. To enable a flag for a subexpression, use `(?X:subexpr)` where X is one of 'i', 'm', or 's'. To disable a flag for a subexpression, use `(-X:subexpr)`. For example, for the case-insensitivity 'i' flag: ``` const re1 = /^[a-z](?-i:[a-z])$/i; re1.test("ab"); // true re1.test("Ab"); // true re1.test("aB"); // false const re2 = /^(?i:[a-z])[a-z]$/; re2.test("ab"); // true re2.test("Ab"); // true re2.test("aB"); // false ```



Blink component

Blink>JavaScript>Regexp

TAG review

None

TAG review status

Not applicable

Risks



Interoperability and Compatibility

No interoperability risk. This is a Stage 3 TC39 proposal.



Gecko: Positive TC39 Stage 3

WebKit: Positive TC39 Stage 3

Web developers: No signals

Other signals:

WebView application risks

Does this intent deprecate or change behavior of existing APIs, such that it has potentially high risk for Android WebView-based applications?

None



Debuggability

No special needs. JS RegExps already debuggable.



Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, ChromeOS, Android, and Android WebView)?

Yes

Is this feature fully tested by web-platform-tests?

Yes

In test262: https://github.com/tc39/test262/pull/3960



Flag name on chrome://flags

--js-regexp-modifiers

Finch feature name

JavaScriptRegExpModifiers

Requires code in //chrome?

False

Estimated milestones

DevTrial on desktop122
DevTrial on Android122


Anticipated spec changes

Open questions about a feature may be a source of future web compat or interop issues. Please list open issues (e.g. links to known github issues in the project for the feature specification) whose resolution may introduce web compat/interop risk (e.g., changing to naming or structure of the API in a non-backward-compatible way).

None

Link to entry on the Chrome Platform Status

https://chromestatus.com/feature/5100254548721664

This intent message was generated by Chrome Platform Status.

Mike Taylor

unread,
Mar 27, 2024, 2:11:01 PMMar 27
to Shu-yu Guo, blink-dev

LGTM1 - looks like a useful addition already supported in a number of other RegExp engines.

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAN-e9e948%3DQSg6zskRN25JGkvxXVP67RDkXHvijzBRueP1DnzA%40mail.gmail.com.

Domenic Denicola

unread,
Mar 27, 2024, 10:38:12 PMMar 27
to Mike Taylor, Shu-yu Guo, blink-dev

Yoav Weiss (@Shopify)

unread,
Apr 3, 2024, 11:47:41 AMApr 3
to Domenic Denicola, Mike Taylor, Shu-yu Guo, blink-dev
Reply all
Reply to author
Forward
0 new messages