[esnext] Ship String.p.matchAll/RegExp.p.[@@matchAll]
Enable --harmony-string-matchall by default. String.prototype.matchAll behaves similarly to String.prototype.match, but returns a full regexp result object for each match in a global or sticky regexp. This offers a simple way to iterate over matches when access to e.g. capture groups is needed. const string = 'a b c'; const regex = /[ac]/g; for (const match of string.matchAll(regex)) { console.log(`${match[0]} at ${match.index}`); } // a at 0 // c at 4 More information can be found here: https://github.com/tc39/proposal-string-matchall Drive-by: Update debug evaluate side effect expectations to handle String.p.matchAll and RegExp.p[@@matchAll] Bug: v8:6890 Change-Id: Ie3e712af66689936b7d2a15df705b792ccf06bd3 Reviewed-on: https://chromium-review.googlesource.com/c/1377774Reviewed-by: Mathias Bynens <mathias@chromium.org> Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org> Reviewed-by: Jakob Gruber <jgruber@chromium.org> Commit-Queue: Peter Wong <peter.wm.wong@gmail.com> Cr-Commit-Position: refs/heads/master@{#58250}
Showing
Please
register
or
sign in
to comment