Skip to content

Inconsistent ordering for regex named capture groups in v12.11.0 #29878

Closed
@KodiVerse

Description

@KodiVerse

node:v12.11.0

There is inconsistent ordering for named capture groups from v12.10.0 to v12.11.0. It appears that versions that came before v12.11.0 ordered the keys by the way they were ordered in the regular expression. v12.11.0 seems to sort the keys.

const r = /(?<BKey>.+)\s(?<AKey>.+)/;
const s = 'example string';
// node v12.10.0
r.exec(s).groups;
// { "BKey": "example", "AKey": "string" }
// node v12.11.0
r.exec(s).groups;
// { "AKey": "string", "BKey": "example" }

Metadata

Metadata

Assignees

No one assigned

    Labels

    v8 engineIssues and PRs related to the V8 dependency.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions