firasdib / Regex101

This repository is currently only used for issue tracking for www.regex101.com
3.21k stars 198 forks source link

ECMAScript regexp v flag #2074

Closed noraj closed 1 year ago

noraj commented 1 year ago

Feature

When ECMAScript is selected, the vflag is missing

image

//v is an upgrade of //u see https://v8.dev/features/regexp-v-flag

atjn commented 1 year ago

This is also called the unicode sets/UnicodeSets flag, for searchability.

There are more technical details here: https://github.com/tc39/proposal-regexp-v-flag

poebrand commented 1 year ago

Anything that can be done to prioritize support for the v flag would be greatly appreciated. Apparently Google went and rolled out a change in Chrome v114 regarding the pattern attribute on HTML input elements. Chrome now assumes that the RegEx within the pattern attribute is based on the v flag instead of the previous u flag.

firasdib commented 1 year ago

I cannot see this flag in the official language specification: https://tc39.es/ecma262/multipage/text-processing.html#sec-get-regexp.prototype.flags

Is this something made up by the Chromium team?

atjn commented 1 year ago

@firasdib It will be merged into the spec any day: https://github.com/tc39/ecma262/pull/2418

I can understand if you don't want to implement this before it is an official spec, but I will note that all major browsers have implemented the feature and have/will soon ship it in a stable release, so it is unlikely that the spec will be removed or changed in any major way.

noraj commented 1 year ago

I cannot see this flag in the official language specification: https://tc39.es/ecma262/multipage/text-processing.html#sec-get-regexp.prototype.flags

Is this something made up by the Chromium team?

It's a feature proposal, Chrome is an earlier adopter before it has officially been validated.

noraj commented 1 year ago

@firasdib It will be merged into the spec any day: tc39/ecma262#2418

I can understand if you don't want to implement this before it is an official spec, but I will note that all major browser have implemented the feature and have/will soon ship it in a stable release, so it is unlikely that the spec will be removed or changed in any major way.

It's already integrated in stable releases of Chromium-based browsers but not on Firefox-based browsers.

atjn commented 1 year ago

It's already integrated in stable releases of Chromium-based browsers but not on Firefox-based browsers.

It is integrated into Firefox nightly, planned for release in stable Firefox 116. It is also integrated in Safari 17 beta, which will soon be promoted to Safari 17 stable.

At this stage, it is very likely that the feature will ship in Firefox 116 and Safari 17 approximately 1-3 months from now.

poebrand commented 1 year ago

@firasdib It will be merged into the spec any day: tc39/ecma262#2418 I can understand if you don't want to implement this before it is an official spec, but I will note that all major browser have implemented the feature and have/will soon ship it in a stable release, so it is unlikely that the spec will be removed or changed in any major way.

It's already integrated in stable releases of Chromium-based browsers but not on Firefox-based browsers.

Side note: I added comments in the following places indicating concerns around Chrome having rolled out the v flag before the ECMAScript spec is official (https://github.com/tc39/proposal-regexp-v-flag).

mathiasbynens commented 1 year ago

@poebrand You might be interested in https://tc39.es/process-document/ which describes the TC39 process for standardizing a new ECMAScript feature. Note that one of the requirements for Stage 4 advancement is having multiple independent shipping implementations. It's unrealistic to expect implementers to wait until a proposal has reached Stage 4 and is merged into the spec, since merging into the spec is blocked on implementers shipping.

michaelficarra commented 1 year ago

The spec changes for unicode sets (and the v flag) have been merged. See https://tc39.es/ecma262/multipage.

firasdib commented 1 year ago

Thank you for the updates. The character class features seem great, but I have a really hard time digesting \q{...}.

firasdib commented 1 year ago

This feature will be included int he next release, thanks for all the references.