Contact emails
peter....@gmail.com
jgr...@chromium.org
yan...@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.
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.
Contact emails
peter....@gmail.com
jgr...@chromium.org
yan...@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.
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.
--
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.
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[0]} at ${match.index} with '${match.input}'`);
}
// > DEADBEEF at 19 with 'Magic hex numbers: DEADBEEF CAFE 8BADF00D'
// > CAFE at 28 with 'Magic hex numbers: DEADBEEF CAFE 8BADF00D'
// > 8BADF00D at 33 with 'Magic hex numbers: DEADBEEF CAFE 8BADF00D'
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/2acc30c4-d827-47ba-be2a-72ad9ade8c6c%40chromium.org.
--
--
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
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.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CABc02_%2B3fQY6xA%3D5uh5pj2jrxQB%2Bg5wAWJT%2BVDsCx1%2BkFuJiZg%40mail.gmail.com.