Skip to content

Commit 4868df6

Browse files
Use v RegExp flag instead of u for <input pattern>
This makes the pattern attribute more powerful, enabling the use of RegExp set notation syntax and properties of strings in its values. Differences with the previous u flag-based behavior: - [FEATURE] Previously invalid patterns now become valid, e.g.: pattern="[\p{ASCII_Hex_Digit}--[Ff]]" pattern="\p{RGI_Emoji}" pattern="[_\q{a|bc|def}]" - [BREAKING CHANGE] Some previously valid patterns are now errors, specifically those with a character class including either an unescaped special character ( ) [ ] { } / - \ | or a double punctuator. - [STATUS QUO] Other previously valid patterns still behave the same. (Other than the above-mentioned features, the v flags only differs in behavior from the u flag w.r.t. case-insensitive matching, but the pattern attribute uses case-sensitive matching.) Tests: web-platform-tests/wpt#38547. Fixes #7908.
1 parent 5e4c22e commit 4868df6

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

source

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3032,6 +3032,9 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
30323032
<ul class="brief">
30333033
<li>The <dfn data-x-href="https://tc39.es/proposal-resizablearraybuffer/#sec-isarraybufferviewoutofbounds">IsArrayBufferViewOutOfBounds</dfn> abstract operation</li>
30343034
</ul>
3035+
3036+
<p>User agents that support JavaScript must also implement the <cite>RegExp <code data-x="">v</code> flag</cite>
3037+
proposal. <ref spec=JSREGEXPVFLAG></p>
30353038
</dd>
30363039

30373040
<dt>WebAssembly</dt>
@@ -50855,7 +50858,8 @@ ldh-str = &lt; as defined in <a href="https://www.rfc-editor.org/rfc/rfc10
5085550858
data-x="concept-fe-values">values</span>, are to be checked.</p>
5085650859

5085750860
<p>If specified, the attribute's value must match the JavaScript <i
50858-
data-x="js-prod-Pattern">Pattern</i><sub><code data-x="">[+UnicodeMode, +N]</code></sub> production.</p>
50861+
data-x="js-prod-Pattern">Pattern</i><sub><code data-x="">[+UnicodeSetsMode, +N]</code></sub> production. <ref
50862+
spec=JSREGEXPVFLAG></p>
5085950863

5086050864
<div w-nodev>
5086150865

@@ -50871,7 +50875,7 @@ ldh-str = &lt; as defined in <a href="https://www.rfc-editor.org/rfc/rfc10
5087150875
data-x="attr-input-pattern">pattern</code> attribute of the element.</p></li>
5087250876

5087350877
<li><p>Let <var>regexpCompletion</var> be <span>RegExpCreate</span>(<var>pattern</var>,
50874-
"<code data-x="">u</code>"). <ref spec=JAVASCRIPT></p></li>
50878+
"<code data-x="">v</code>"). <ref spec=JSREGEXPVFLAG></p></li>
5087550879

5087650880
<li>
5087750881
<p>If <var>regexpCompletion</var> is an <span data-x="Completion Record">abrupt
@@ -50886,7 +50890,7 @@ ldh-str = &lt; as defined in <a href="https://www.rfc-editor.org/rfc/rfc10
5088650890
<var>pattern</var>, followed by "<code data-x="">)$</code>".</p></li>
5088750891

5088850892
<li><p>Return ! <span>RegExpCreate</span>(<var>anchoredPattern</var>, "<code
50889-
data-x="">u</code>").</p></li>
50893+
data-x="">v</code>").</p></li>
5089050894
</ol>
5089150895

5089250896
<p class="note">The reasoning behind these steps, instead of just using the value of the <code
@@ -133426,6 +133430,9 @@ INSERT INTERFACES HERE
133426133430
<dt id="refsJSJSONMODULES">[JSJSONMODULES]</dt>
133427133431
<dd><cite><a href="https://tc39.es/proposal-json-modules/">JSON Modules</a></cite>. Ecma International.</dd>
133428133432

133433+
<dt id="refsJSREGEXPVFLAG">[JSREGEXPVFLAG]</dt>
133434+
<dd><cite><a href="https://github.com/tc39/proposal-regexp-v-flag">RegExp <code data-x="">v</code> flag with set notation + properties of strings</a></cite>. Ecma International.</dd>
133435+
133429133436
<dt id="refsJSRESIZABLEBUFFERS">[JSRESIZABLEBUFFERS]</dt>
133430133437
<dd><cite><a href="https://tc39.es/proposal-resizablearraybuffer/">Resizable ArrayBuffer and growable SharedArrayBuffer</a></cite>. Ecma International.</dd>
133431133438

0 commit comments

Comments
 (0)