Intent to Ship: RegExp @@matchAll / String.prototype.matchAll

14 views
Skip to first unread message

Peter Wong

unread,
Dec 13, 2018, 5:01:30 PM12/13/18
to v8-...@googlegroups.com, v8-u...@googlegroups.com, blin...@chromium.org, jgr...@chromium.org, yan...@chromium.org, mat...@chromium.org

Contact emails
peter....@gmail.com
jgr...@chromium.org
yan...@chromium.org

mat...@chromium.org


Spec
https://github.com/tc39/proposal-string-matchall/

https://tc39.github.io/proposal-string-matchall/


Summary
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.

Motivation
This offers a simple way to iterate over matches when access to e.g. capture groups is needed.

const string = 'Magic hex numbers: DEADBEEF CAFE 8BADF00D';
const regex = /\b[0-9a-fA-F]+\b/g;
for (const match of string.matchAll(regex)) {
 console
.log(match);
}

// Iteration 1:
[
 
'DEADBEEF',
 index
: 19,
 input
: 'Magic hex numbers: DEADBEEF CAFE 8BADF00D'
]

// Iteration 2:
[
 
'CAFE',
 index
: 28,
 input
: 'Magic hex numbers: DEADBEEF CAFE 8BADF00D'
]

// Iteration 3:
[
 
'8BADF00D',
 index
: 33,
 input
: 'Magic hex numbers: DEADBEEF CAFE 8BADF00D'
]


Interoperability risk
Firefox: In development - https://bugzilla.mozilla.org/show_bug.cgi?id=1435829
Edge: No public signals
Safari: No public signals - https://bugs.webkit.org/show_bug.cgi?id=186694
Web developers: Positive

Compatibility risk
The spec has undergone a few updates and depending on whether other implementations have kept up, there is a possibility V8 could differ in behavior.  At the time of writing, V8 is current with all the latest spec updates and have contributed updates to the test262 test suite to minimize difference between other implementations.


V8 tests (mjsunit) as well as all test262 tests pass for this feature.

Will this feature be supported on all six Blink platforms (Windows, Mac, Linux,
Chrome OS, Android, and Android WebView)?

Yes

Link to entry on the Chrome Platform Status
https://www.chromestatus.com/features/5520028858318848

Requesting approval to ship?
Yes. Note that since this is a V8/JS feature, this post is just an FYI to blink-dev — no signoff from Blink API owners is required.


Sathya Gunasekaran

unread,
Dec 13, 2018, 6:27:20 PM12/13/18
to v8-...@googlegroups.com, v8-users, blink-dev, Jakob Gruber, yan...@chromium.org, Mathias Bynens
LGTM
> --
> --
> v8-dev mailing list
> v8-...@googlegroups.com
> http://groups.google.com/group/v8-dev
> ---
> You received this message because you are subscribed to the Google Groups "v8-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to v8-dev+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Adam Klein

unread,
Dec 13, 2018, 7:57:27 PM12/13/18
to Sathya Gunasekaran, v8-...@googlegroups.com, v8-users, blink-dev, Jakob Gruber, Yang Guo, Mathias Bynens
LGTM2

You received this message because you are subscribed to the Google Groups "blink-dev" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAMd%2BM7zTAcnN5Aqwr1XdpBfd45Het_nOq2%3Deu6U_TvTRRDtVOQ%40mail.gmail.com.

Jakob Gruber

unread,
Dec 14, 2018, 1:37:51 AM12/14/18
to v8-...@googlegroups.com, gsa...@chromium.org, v8-u...@googlegroups.com, blin...@chromium.org, Yang Guo, mat...@chromium.org
LGTM3

Mathias Bynens

unread,
Dec 14, 2018, 5:50:38 AM12/14/18
to v8-...@googlegroups.com, gsa...@chromium.org, v8-users, blink-dev, Yang Guo
LGTM∞

PhistucK

unread,
Dec 14, 2018, 7:17:57 AM12/14/18
to peter....@gmail.com, v8-...@googlegroups.com, v8-users, blink-dev, jgr...@chromium.org, Yang Guo, Mathias Bynens
Can you make the example clearer?
["...", index: 0, input: "..."] is unfamiliar, invalid syntax.

PhistucK


--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAAKm-Q%2BuNU%3D%2BbSgu87THKGedRbf1OuCQSsJbmRgK5iPWAVO%2BDA%40mail.gmail.com.

Benedikt Meurer

unread,
Dec 14, 2018, 7:29:17 AM12/14/18
to v8-u...@googlegroups.com, peter....@gmail.com, v8-...@googlegroups.com, blink-dev, jgr...@chromium.org, Yang Guo, Mathias Bynens
LGTM!

--
--
v8-users mailing list
v8-u...@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups "v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
--

Benedikt Meurer

Software Engineer

bme...@google.com


Google Germany GmbH

Erika-Mann-Straße 33

80636 München


Geschäftsführer: Paul Manicle, Halimah DeLaine Prado

Registergericht und -nummer: Hamburg, HRB 86891

Sitz der Gesellschaft: Hamburg


Diese E-Mail ist vertraulich. Falls sie diese fälschlicherweise erhalten haben sollten, leiten Sie diese bitte nicht an jemand anderes weiter, löschen Sie alle Kopien und Anhänge davon und lassen Sie mich bitte wissen, dass die E-Mail an die falsche Person gesendet wurde.

    

This e-mail is confidential. If you received this communication by mistake, please don't forward it to anyone else, please erase all copies and attachments, and please let me know that it has gone to the wrong person.

jassey...@gmail.com

unread,
Jun 14, 2019, 6:52:15 AM6/14/19
to blink-dev, v8-...@googlegroups.com, v8-u...@googlegroups.com, jgr...@chromium.org, yan...@chromium.org, mat...@chromium.org


On Friday, December 14, 2018 at 12:27:22 AM UTC+1, Sathya Gunasekaran wrote:
LGTM
On Thu, Dec 13, 2018 at 2:01 PM Peter Wong <peter...@gmail.com> wrote:
>
> Contact emails
> peter...@gmail.com
> To unsubscribe from this group and stop receiving emails from it, send an email to v8-...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages