Bug 292429

Summary: [Regex] Nested negated classes leads to incorrect matches
Product: WebKit Reporter: Antoine Lethimonnier <ames_cedre_8b>
Component: JavaScriptCoreAssignee: daniel_liu4
Status: RESOLVED FIXED    
Severity: Normal CC: keith_miller, msaboff, steves_list, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 18   
Hardware: All   
OS: All   

Antoine Lethimonnier
Reported 2025-05-02 04:38:58 PDT
As identified in https://github.com/shikijs/shiki#1005, a WebKit bug results in nested negated character classes being treated as if they weren't negated. For example, in WebKit (as of Safari 18.4), /[a[^a-z]]/v incorrectly matches 'b' and incorrectly fails to match '!'. This can be worked around by converting e.g. [a[^a-z]] to (?:[a]|[^a-z]).
Attachments
Radar WebKit Bug Importer
Comment 1 2025-05-09 04:42:05 PDT
daniel_liu4
Comment 2 2025-05-21 16:02:29 PDT
EWS
Comment 3 2025-05-22 09:36:47 PDT
Committed 295277@main (c07d637bf020): <https://commits.webkit.org/295277@main> Reviewed commits have been landed. Closing PR #45731 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.