Tan Li Hau 6a9d2538e0 fix capturing group for matchAll (#10136)
* fix capturing group for matchAll

* update test case

* add core-js/features/string/match-all to test
2019-07-26 18:53:22 -04:00

15 lines
340 B
JavaScript

const string = "Favorite GitHub repos: tc39/ecma262 v8/v8.dev";
const regex = /\b(?<owner>[a-z0-9]+)\/(?<repo>[a-z0-9\.]+)\b/g;
const matches = string.matchAll(regex);
expect(matches.next().value.groups).toEqual({
owner: "tc39",
repo: "ecma262",
});
expect(matches.next().value.groups).toEqual({
owner: "v8",
repo: "v8.dev",
});