-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Closed
Labels
Has PRoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue
Description
Bug Report
Current Behavior
Output code after transpilation doesn't work as expected. It returns undefined capture groups. See below.
Input Code
I took last example from here: https://v8.dev/features/string-matchall (repl)
const string = 'Favorite GitHub repos: tc39/ecma262 v8/v8.dev';
const regex = /\b(?<owner>[a-z0-9]+)\/(?<repo>[a-z0-9\.]+)\b/g;
for (const match of string.matchAll(regex)) {
console.log(`${match[0]} at ${match.index} with '${match.input}'`);
console.log(`→ owner: ${match.groups.owner}`);
console.log(`→ repo: ${match.groups.repo}`);
}It returns this when you run it just like this before Babel:
tc39/ecma262 at 23 with 'Favorite GitHub repos: tc39/ecma262 v8/v8.dev'
→ owner: tc39
→ repo: ecma262
v8/v8.dev at 36 with 'Favorite GitHub repos: tc39/ecma262 v8/v8.dev'
→ owner: v8
→ repo: v8.dev
Expected behavior/code
It should return the same output. Unfortunately, it returns this:
tc39/ecma262 at 23 with 'Favorite GitHub repos: tc39/ecma262 v8/v8.dev'
→ owner: undefined
→ repo: undefined
v8/v8.dev at 36 with 'Favorite GitHub repos: tc39/ecma262 v8/v8.dev'
→ owner: undefined
→ repo: undefined
(capturing groups got lost and return undefined values after translation)
Babel Configuration (.babelrc, package.json, cli command)
Reproducible in REPL with env preset and Node.js <9 (latest Node.js are broken in REPL).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Has PRoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue