Bug 249146

Summary: Regular expression fails in WebKit only: invalid group specifier name
Product: WebKit Reporter: Vladimir Prelovac <vprelovac>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: karlcow, mark.lam, msaboff, webkit-bug-importer
Priority: P2 Keywords: BrowserCompat, InRadar
Version: Safari 16   
Hardware: Unspecified   
OS: Unspecified   

Vladimir Prelovac
Reported 2022-12-12 07:09:49 PST
The following regular expression works in Chrome and Firefox, but fails in WebKit: let tokens = "test".match(/(?<=\s+|^)["'‘“'"[({⟨]?(.*?[.?!])(\s[.?!])*["'’”'"\])}⟩]?(?=\s+|$)|(?<=\s+|^)\S(.*?[.?!])(\s[.?!])*(?=\s+|$)/g); SyntaxError: Invalid regular expression: invalid group specifier name
Attachments
Radar WebKit Bug Importer
Comment 1 2022-12-16 15:02:31 PST
Michael Saboff
Comment 2 2022-12-16 15:30:28 PST
This was fixed with commit 257823@main (46e6b3f97425): <https://commits.webkit.org/257823@main>. *** This bug has been marked as a duplicate of bug 174931 ***
Vladimir Prelovac
Comment 3 2022-12-16 18:48:57 PST
(In reply to Michael Saboff from comment #2) > This was fixed with commit 257823@main (46e6b3f97425): > <https://commits.webkit.org/257823@main>. > > *** This bug has been marked as a duplicate of bug 174931 *** I've compiled trunk with the patch in and want to report that this problem is still not fixed.
Mark Lam
Comment 4 2022-12-16 18:54:27 PST
(In reply to Vladimir Prelovac from comment #3) > > *** This bug has been marked as a duplicate of bug 174931 *** > > I've compiled trunk with the patch in and want to report that this problem > is still not fixed. Are you sure you're building the latest trunk? I just tried against trunk also, and I also no longer see that SyntaxError. Looks fixed to me.
Vladimir Prelovac
Comment 5 2022-12-16 18:59:06 PST
(In reply to Mark Lam from comment #4) > (In reply to Vladimir Prelovac from comment #3) > > > *** This bug has been marked as a duplicate of bug 174931 *** > > > > I've compiled trunk with the patch in and want to report that this problem > > is still not fixed. > > Are you sure you're building the latest trunk? I just tried against trunk > also, and I also no longer see that SyntaxError. Looks fixed to me. Thanks for double checking. I did indeed pull the trunk an hour ago and verified it is latest trunk by verifying the patch was applied. (for example Source/JavaScriptCore/runtime/RegExp.cpp line 252 is " && !pattern.m_containsLookbehinds") The Webkit version also shows as 615.1.15+ Then I went to https://runjs.co (since don't have inspector in minibrowser/run-safari) and ran: let tokens = "test".match(/(?<=\s+|^)["'‘“'"[({⟨]?(.*?[.?!])(\s[.?!])*["'’”'"\])}⟩]?(?=\s+|$)|(?<=\s+|^)\S(.*?[.?!])(\s[.?!])*(?=\s+|$)/g); Producing: SyntaxError: Invalid regular expression: invalid group specifier name
Vladimir Prelovac
Comment 6 2022-12-16 19:09:38 PST
My bad, run-minibrowser does not produce error, run-safari does, so I will assume that the problem is on my end. Thanks.
Note You need to log in before you can comment on or make changes to this bug.