RESOLVED FIXED289337
REGRESSION (285042@main-285687@main): `RegExp["$&"]` incorrectly returns an empty string
https://bugs.webkit.org/show_bug.cgi?id=289337
Summary REGRESSION (285042@main-285687@main): `RegExp["$&"]` incorrectly returns an e...
RiskyMH
Reported 2025-03-07 07:04:32 PST
`RegExp["$&"]` should return the last matched substring but now returns an empty string when using `.match(/bar/g)`. However, it works if the match includes a capturing group. ```js "foo bar baz".match(/bar/g); console.log([RegExp["$&"]]); // Expected: ["bar"], Current: [""] "foo bar baz".match(/ba(r)/g); console.log([RegExp["$&"]]); // Expected and Current: ["bar"] ``` Observed Behavior: - Broke between WebKit commits `96471cc` and `1b53bfc` - See bun's fork diff https://github.com/oven-sh/WebKit/compare/543cca2...9b84f43 (bun `1.1.33..1.1.34`) Possible Cause: https://commits.webkit.org/285090@main --- reported on Bun's repo https://github.com/oven-sh/bun/issues/17978
Attachments
Radar WebKit Bug Importer
Comment 1 2025-03-09 18:38:12 PDT
Yusuke Suzuki
Comment 2 2025-03-09 21:33:43 PDT
EWS
Comment 3 2025-03-10 01:25:52 PDT
Committed 291881@main (cc0a0f907148): <https://commits.webkit.org/291881@main> Reviewed commits have been landed. Closing PR #42177 and removing active labels.
EWS
Comment 4 2025-03-11 17:00:59 PDT
Committed 289651.257@safari-7621-branch (90e15f4a2340): <https://commits.webkit.org/289651.257@safari-7621-branch> Reviewed commits have been landed. Closing PR #2776 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.