packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/match-all/exec.js
raw| 1 | const string = "Favorite GitHub repos: tc39/ecma262 v8/v8.dev"; |
| 2 | const regex = /\b(?<owner>[a-z0-9]+)\/(?<repo>[a-z0-9\.]+)\b/g; |
| 3 | |
| 4 | const matches = string.matchAll(regex); |
| 5 | |
| 6 | expect(matches.next().value.groups).toEqual({ |
| 7 | owner: "tc39", |
| 8 | repo: "ecma262", |
| 9 | }); |
| 10 | |
| 11 | expect(matches.next().value.groups).toEqual({ |
| 12 | owner: "v8", |
| 13 | repo: "v8.dev", |
| 14 | }); |