WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
285807
RegExp with lookbehind returns fewer matches in Safari than Chrome (?<=(?:do\(\)|^)(?:[^d]|d(?!on't\(\)))*)mul\((\d{1,3}),(\d{1,3})\)/
https://bugs.webkit.org/show_bug.cgi?id=285807
Summary
RegExp with lookbehind returns fewer matches in Safari than Chrome (?<=(?:do\...
Jarred Sumner
Reported
2025-01-11 18:48:40 PST
Reproduction: ``` const str = ` mul(1,2)select()don't()select()select()}<-when()?}mul(601,494)mul(184,68)mul(703,694)&;;!}![mul(255,743)who()* ^select()%mul(772,315)what()-mul(799,280):who()why();!what()]+what()how(847,982)mul(276,198);select()<*;>:,@mul(293,345)/)what()%!what()<~mul(959,852)/+$why()^<!-mul(756,324)how()>why()where(),@mul(281,314)#when()%]! -mul(347{why()select()why():)^~mul(10,106)%+?%when()mul(941,657)select()when()&,@@'@mul(250,253)#,what()mul(539,823);^*<[mul(422,155)who(){$:-&#mul:mul(61,174):why()'where()don't()select()<&+!/@&<-mul(596,236)~mul(339,838)'}mul(263,931)!how()mul(65,701)from()'/>/)mul(879,804)how() {*((mul(213,689)*[when()}what()?where())mul(727,958)mul(246,840)+mul(150,479)>?~from()*mul(552,678)?don't()$~?'mul(97,380)>mul(968,76)}#!from()mul(435,362why()#}when()*[how()'!#mul(357,345)}?why()[[mul(356,875)%when())$#mul{from()mul(289,657)from(681,624)'<;who()mul(514,298);{ mul-/[(:who():mul(789,109)where()%}what(435,852)mul(330,192)why();)$-]+mul(617,542)mul(244,889)?*%'>!mul(799,990)from()(mul(234,708) @; ;?&]?#mul(577,752)%*)$&why()!%[mul(7,487)how(),@]select()$mul(38-?-+:^[from()#mul(252,810)who()]<+<who()how()]mul(85{$+who()mul(30,63)~who(743,434)~;mul(808,964)~?mul(459,384)>!)mul(976,357)[}mul(341,264)/#select(),%select()&mul(547,552)where()from()@+}#:mul(592,61)&how()what();select()!^select()(mul(273,4)'/^mul(446,170)%]]'~+mul(678,454)when()}select())/?#+}mul(180,876)-%%why()mul(255,652)]why()$#!mul(114,812)-?mul(207,511)<who()<>[$how()+}^mul(790,315)%who()/&<mul(631,708)+%+mul(674,272)when(792,225)&~how()}+how()mul(342 /where()how()who(){<{~mul(848,950)>]do()]#@why()/mul(743,708) `; const regex = /(?<=(?:do\(\)|^)(?:[^d]|d(?!on't\(\)))*)mul\((\d{1,3}),(\d{1,3})\)/g; const matches = str.matchAll(regex); const matchesArr = [...matches]; globalThis.console ??= { log: (args) => print(JSON.stringify(args, null, 2)) }; console.log(matchesArr.map(match => match[0])); ``` Chrome & Node.js: ``` [ 'mul(1,2)', 'mul(743,708)' ] ``` Safari Technology Preview, jsc shell, and Bun: ``` ["mul(1,2)"] ``` From
https://github.com/oven-sh/bun/issues/16338
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2025-01-18 18:49:12 PST
<
rdar://problem/143202375
>
daniel_liu4
Comment 2
2025-01-21 17:07:50 PST
Pull request:
https://github.com/WebKit/WebKit/pull/39357
EWS
Comment 3
2025-01-23 15:54:22 PST
Committed
289319@main
(d30962803be5): <
https://commits.webkit.org/289319@main
> Reviewed commits have been landed. Closing PR #39357 and removing active labels.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug