WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 214181
RegExp sticky not matching alternates correctly, ignoring lastIndex requirement
https://bugs.webkit.org/show_bug.cgi?id=214181
Summary
RegExp sticky not matching alternates correctly, ignoring lastIndex requirement
eoind
Reported
2020-07-10 04:52:42 PDT
Created
attachment 403958
[details]
Screenshot of Safari console Regular expressions sticky flag is not working correctly when used with alternates (|) Demonstration: (In Safari 13 JS console) Entering `/a|aa/y.exec("_a")` returns `["a"]` when it should return `null`. This is because matches should be restricted to starting at lastIndex which in this case is index 0. Chrome, Firefox and Edge all correctly return `null` Further proof that this is a bug can be seen as follows. Obviously /a|aa/ should be exactly the same as /(a|aa)/ as capturing groups are not relevant. But entering `/(a|aa)/y.exec("_a")` returns `null`. Similarly wrapping the rhs of the alternate expression shouldn't affect the result but `/a|(aa)/y.exec("_a")` also correctly returns `null`. This bug seems related to this bug from 2010:
https://bugs.webkit.org/show_bug.cgi?id=48102
Attachments
Screenshot of Safari console
(27.33 KB, image/png)
2020-07-10 04:52 PDT
,
eoind
no flags
Details
Patch
(6.54 KB, patch)
2020-08-06 21:40 PDT
,
Michael Saboff
ysuzuki
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2020-07-10 12:47:51 PDT
<
rdar://problem/65357986
>
Michael Saboff
Comment 2
2020-08-06 21:39:36 PDT
Thanks for the bug report.
Michael Saboff
Comment 3
2020-08-06 21:40:03 PDT
Created
attachment 406153
[details]
Patch
Yusuke Suzuki
Comment 4
2020-08-06 21:51:37 PDT
Comment on
attachment 406153
[details]
Patch r=me
Michael Saboff
Comment 5
2020-08-07 08:51:35 PDT
Committed
r265373
: <
https://trac.webkit.org/changeset/265373
>
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