<?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>285807</bug_id>
          
          <creation_ts>2025-01-11 18:48:40 -0800</creation_ts>
          <short_desc>RegExp with lookbehind returns fewer matches in Safari than Chrome (?&lt;=(?:do\(\)|^)(?:[^d]|d(?!on&apos;t\(\)))*)mul\((\d{1,3}),(\d{1,3})\)/</short_desc>
          <delta_ts>2025-01-23 15:54:25 -0800</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></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jarred Sumner">jarred</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>mark.lam</cc>
    
    <cc>msaboff</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2086612</commentid>
    <comment_count>0</comment_count>
    <who name="Jarred Sumner">jarred</who>
    <bug_when>2025-01-11 18:48:40 -0800</bug_when>
    <thetext>Reproduction:
```
const str = `
mul(1,2)select()don&apos;t()select()select()}&lt;-when()?}mul(601,494)mul(184,68)mul(703,694)&amp;;;!}![mul(255,743)who()* ^select()%mul(772,315)what()-mul(799,280):who()why();!what()]+what()how(847,982)mul(276,198);select()&lt;*;&gt;:,@mul(293,345)/)what()%!what()&lt;~mul(959,852)/+$why()^&lt;!-mul(756,324)how()&gt;why()where(),@mul(281,314)#when()%]! -mul(347{why()select()why():)^~mul(10,106)%+?%when()mul(941,657)select()when()&amp;,@@&apos;@mul(250,253)#,what()mul(539,823);^*&lt;[mul(422,155)who(){$:-&amp;#mul:mul(61,174):why()&apos;where()don&apos;t()select()&lt;&amp;+!/@&amp;&lt;-mul(596,236)~mul(339,838)&apos;}mul(263,931)!how()mul(65,701)from()&apos;/&gt;/)mul(879,804)how() {*((mul(213,689)*[when()}what()?where())mul(727,958)mul(246,840)+mul(150,479)&gt;?~from()*mul(552,678)?don&apos;t()$~?&apos;mul(97,380)&gt;mul(968,76)}#!from()mul(435,362why()#}when()*[how()&apos;!#mul(357,345)}?why()[[mul(356,875)%when())$#mul{from()mul(289,657)from(681,624)&apos;&lt;;who()mul(514,298);{ mul-/[(:who():mul(789,109)where()%}what(435,852)mul(330,192)why();)$-]+mul(617,542)mul(244,889)?*%&apos;&gt;!mul(799,990)from()(mul(234,708)
@; ;?&amp;]?#mul(577,752)%*)$&amp;why()!%[mul(7,487)how(),@]select()$mul(38-?-+:^[from()#mul(252,810)who()]&lt;+&lt;who()how()]mul(85{$+who()mul(30,63)~who(743,434)~;mul(808,964)~?mul(459,384)&gt;!)mul(976,357)[}mul(341,264)/#select(),%select()&amp;mul(547,552)where()from()@+}#:mul(592,61)&amp;how()what();select()!^select()(mul(273,4)&apos;/^mul(446,170)%]]&apos;~+mul(678,454)when()}select())/?#+}mul(180,876)-%%why()mul(255,652)]why()$#!mul(114,812)-?mul(207,511)&lt;who()&lt;&gt;[$how()+}^mul(790,315)%who()/&amp;&lt;mul(631,708)+%+mul(674,272)when(792,225)&amp;~how()}+how()mul(342 /where()how()who(){&lt;{~mul(848,950)&gt;]do()]#@why()/mul(743,708)
`;

const regex = /(?&lt;=(?:do\(\)|^)(?:[^d]|d(?!on&apos;t\(\)))*)mul\((\d{1,3}),(\d{1,3})\)/g;

const matches = str.matchAll(regex);
const matchesArr = [...matches];

globalThis.console ??= { log: (args) =&gt; print(JSON.stringify(args, null, 2)) };
console.log(matchesArr.map(match =&gt; match[0]));
```

Chrome &amp; Node.js:
```
[ &apos;mul(1,2)&apos;, &apos;mul(743,708)&apos; ]
```

Safari Technology Preview, jsc shell, and Bun:
```
[&quot;mul(1,2)&quot;]
```

From https://github.com/oven-sh/bun/issues/16338</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2088362</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2025-01-18 18:49:12 -0800</bug_when>
    <thetext>&lt;rdar://problem/143202375&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2088858</commentid>
    <comment_count>2</comment_count>
    <who name="">daniel_liu4</who>
    <bug_when>2025-01-21 17:07:50 -0800</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/39357</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2089374</commentid>
    <comment_count>3</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2025-01-23 15:54:22 -0800</bug_when>
    <thetext>Committed 289319@main (d30962803be5): &lt;https://commits.webkit.org/289319@main&gt;

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

    </bug>

</bugzilla>