<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>289337</bug_id>
          
          <creation_ts>2025-03-07 07:04:32 -0800</creation_ts>
          <short_desc>REGRESSION (285042@main-285687@main): `RegExp[&quot;$&amp;&quot;]` incorrectly returns an empty string</short_desc>
          <delta_ts>2025-03-11 17:00:59 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>https://github.com/oven-sh/bun/issues/17978</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar, Regression</keywords>
          <priority>P2</priority>
          <bug_severity>Minor</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="RiskyMH">webkit</reporter>
          <assigned_to name="Yusuke Suzuki">ysuzuki</assigned_to>
          <cc>ben</cc>
    
    <cc>mark.lam</cc>
    
    <cc>msaboff</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>yijia_huang</cc>
    
    <cc>ysuzuki</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2101363</commentid>
    <comment_count>0</comment_count>
    <who name="RiskyMH">webkit</who>
    <bug_when>2025-03-07 07:04:32 -0800</bug_when>
    <thetext>`RegExp[&quot;$&amp;&quot;]` 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
&quot;foo bar baz&quot;.match(/bar/g);
console.log([RegExp[&quot;$&amp;&quot;]]);  // Expected: [&quot;bar&quot;], Current: [&quot;&quot;]

&quot;foo bar baz&quot;.match(/ba(r)/g);
console.log([RegExp[&quot;$&amp;&quot;]]);  // Expected and Current: [&quot;bar&quot;]
```

Observed Behavior:

- Broke between WebKit commits `96471cc` and `1b53bfc`
- See bun&apos;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&apos;s repo https://github.com/oven-sh/bun/issues/17978</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2101800</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2025-03-09 18:38:12 -0700</bug_when>
    <thetext>&lt;rdar://problem/146622507&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2101820</commentid>
    <comment_count>2</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2025-03-09 21:33:43 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/42177</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2101868</commentid>
    <comment_count>3</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2025-03-10 01:25:52 -0700</bug_when>
    <thetext>Committed 291881@main (cc0a0f907148): &lt;https://commits.webkit.org/291881@main&gt;

Reviewed commits have been landed. Closing PR #42177 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2102393</commentid>
    <comment_count>4</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2025-03-11 17:00:59 -0700</bug_when>
    <thetext>Committed 289651.257@safari-7621-branch (90e15f4a2340): &lt;https://commits.webkit.org/289651.257@safari-7621-branch&gt;

Reviewed commits have been landed. Closing PR #2776 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>