跳至主要內容

RegExp 命名捕获组

小于 1 分钟featurees-proposalmissing-example

RegExp 命名捕获组open in new window

类型

// patched for support `RegExp` named capture groups:
interface RegExp {
  new (pattern: RegExp | string, flags?: string): RegExp;
  exec(): RegExpExecResult | null;
  [Symbol.replace](string: string, replaceValue: Function | string): string;
}

interface RegExpExecResult extends Array<string> {
  groups?: {
    [key: string]: string;
  };
  index: number;
  input: string;
}

入口点

core-js/proposals/regexp-named-groups