RESOLVED FIXED 174044
RegExp's anchored with .* with \g flag can return wrong match start for strings with multiple matches
https://bugs.webkit.org/show_bug.cgi?id=174044
Summary RegExp's anchored with .* with \g flag can return wrong match start for stri...
Michael Saboff
Reported 2017-06-30 14:48:13 PDT
Consider the string: s = "\na\na\na\n"; along with the RegExp: r = new RegExp(".*\\s.*", "g"); The result of s.match(r) should be a match object with 4 entries, "\na", "\na", "\na" & "\n". Instead we get "\na", "a\na", "a\na" & "a\n".
Attachments
Patch (11.38 KB, patch)
2017-06-30 15:23 PDT, Michael Saboff
oliver: review+
Michael Saboff
Comment 1 2017-06-30 15:11:02 PDT
Michael Saboff
Comment 2 2017-06-30 15:23:07 PDT
Oliver Hunt
Comment 3 2017-06-30 15:44:25 PDT
Comment on attachment 314302 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=314302&action=review > Source/JavaScriptCore/yarr/YarrJIT.cpp:2699 > + if (m_pattern.m_saveInitialStartValue) { > +#ifdef HAVE_INITIAL_START_REG > + move(index, initialStart); > +#else > + storeToFrame(index, m_pattern.m_initialStartValueFrameLocation); > +#endif I almost wish we could bludgeon templates into doing this for us. Almost. (I suspect it would turn into "can I implement register allocation with templates at compile time?" questions :D )
Michael Saboff
Comment 4 2017-06-30 18:17:01 PDT
Note You need to log in before you can comment on or make changes to this bug.