RegExp named capture groups

Specification
Proposal repo

Modules

es.regexp.constructor, es.regexp.exec and es.string.replace.

Built-ins signatures

// patched to support `RegExp` named capture groups:
class RegExp {
  constructor(pattern: RegExp | string, flags?: string): RegExp;
  exec(string: string): Array<string | undefined> | null;
  @@replace(string: string, replaceValue: Function | string): string;
}

Entry points

core-js/proposals/regexp-named-groups
core-js/es|stable|actual|full/regexp/constructor
core-js/es|stable|actual|full/regexp/replace
core-js/es|stable|actual|full/string/replace

Examples

RegExp('foo:(?<foo>\\w+),bar:(?<bar>\\w+)').exec('foo:abc,bar:def').groups; // => { foo: 'abc', bar: 'def' }

'foo:abc,bar:def'.replace(RegExp('foo:(?<foo>\\w+),bar:(?<bar>\\w+)'), '$<bar>,$<foo>'); // => 'def,abc'