Contact emails
[email protected]
[email protected]
[email protected]

[email protected]


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.

-- 
-- 
v8-dev mailing list
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to