Created attachment 403958 [details] Screenshot of Safari console Regular expressions sticky flag is not working correctly when used with alternates (|) Demonstration: (In Safari 13 JS console) Entering `/a|aa/y.exec("_a")` returns `["a"]` when it should return `null`. This is because matches should be restricted to starting at lastIndex which in this case is index 0. Chrome, Firefox and Edge all correctly return `null` Further proof that this is a bug can be seen as follows. Obviously /a|aa/ should be exactly the same as /(a|aa)/ as capturing groups are not relevant. But entering `/(a|aa)/y.exec("_a")` returns `null`. Similarly wrapping the rhs of the alternate expression shouldn't affect the result but `/a|(aa)/y.exec("_a")` also correctly returns `null`. This bug seems related to this bug from 2010: https://bugs.webkit.org/show_bug.cgi?id=48102
<rdar://problem/65357986>
Thanks for the bug report.
Created attachment 406153 [details] Patch
Comment on attachment 406153 [details] Patch r=me
Committed r265373: <https://trac.webkit.org/changeset/265373>