WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
272659
Nested duplicate named capturing groups in regex is not syntax error
https://bugs.webkit.org/show_bug.cgi?id=272659
Summary
Nested duplicate named capturing groups in regex is not syntax error
ota-meshi-biz
Reported
2024-04-15 00:05:51 PDT
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
Comment 1
2024-04-22 08:54:27 PDT
<
rdar://problem/126863735
>
Ahmad Saleem
Comment 2
2024-04-22 13:34:22 PDT
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
Comment 3
2024-04-23 01:13:25 PDT
I believe the first one should also be a syntax error. Investigating.
Michael Saboff
Comment 4
2024-04-24 00:34:19 PDT
Testing a fix now.
Michael Saboff
Comment 5
2024-04-24 02:49:19 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/27681
EWS
Comment 6
2024-04-24 09:43:26 PDT
Committed
277928@main
(93db8886b0d3): <
https://commits.webkit.org/277928@main
> Reviewed commits have been landed. Closing PR #27681 and removing active labels.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug