Bug 272659
Summary: | Nested duplicate named capturing groups in regex is not syntax error | ||
---|---|---|---|
Product: | WebKit | Reporter: | ota-meshi-biz <y.ohta.z3> |
Component: | JavaScriptCore | Assignee: | Michael Saboff <msaboff> |
Status: | RESOLVED FIXED | ||
Severity: | Normal | CC: | ahmad.saleem792, karlcow, mark.lam, msaboff, webkit-bug-importer |
Priority: | P2 | Keywords: | BrowserCompat, InRadar |
Version: | Safari 17 | ||
Hardware: | Mac (Apple Silicon) | ||
OS: | macOS 14 |
ota-meshi-biz
When I run the following two regexes in Safari's JavaScript console, one gives a syntax error, but the other does not:
But I expected both to result in a syntax error.
```js
/(?:(?<x>a)|(?<x>b))(?<x>c)/; // not syntax error?
/(?<x>c)(?:(?<x>a)|(?<x>b))/; // syntax error
```
I think they should both be syntax errors, since they're just swapped around. What do you think?
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/126863735>
Ahmad Saleem
It is reproducible in WebKit ToT as well and Chrome Canary 125 and Firefox Nightly 127 both throw 'syntax' error for first one.
Michael Saboff
I believe the first one should also be a syntax error. Investigating.
Michael Saboff
Testing a fix now.
Michael Saboff
Pull request: https://github.com/WebKit/WebKit/pull/27681
EWS
Committed 277928@main (93db8886b0d3): <https://commits.webkit.org/277928@main>
Reviewed commits have been landed. Closing PR #27681 and removing active labels.