Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent ordering for regex named capture groups in v13 #31232

Closed
KodiVerse opened this issue Jan 6, 2020 · 5 comments
Closed

Inconsistent ordering for regex named capture groups in v13 #31232

KodiVerse opened this issue Jan 6, 2020 · 5 comments

Comments

@KodiVerse
Copy link

KodiVerse commented Jan 6, 2020

node:v13

There is inconsistent ordering for named capture groups from v12 to v13. This issue was previously addressed in: #29878

const r = /(?<BKey>.+)\s(?<AKey>.+)/;
const s = 'example string';
// node v12
r.exec(s).groups;
// { "BKey": "example", "AKey": "string" }
// node v13
r.exec(s).groups;
// { "AKey": "string", "BKey": "example" }
@Trott
Copy link
Member

Trott commented Jan 6, 2020

The behavior you list as node v12 was a bug. It was fixed in Node.js 12.13.1. I'd therefore expect that you are running 12.13.0 or earlier which is why you see the bug. (EDIT: It would appear the bug was introduced in 12.11.0, so I'd speculate that your 12.x is between 12.11.0 and 12.13.0 inclusive.)

Node.js 12.13.1 and the most recent 13.x releases show the behavior you list for v13. That behavior is correct.

@KodiVerse
Copy link
Author

Sorry node:12 this issue was fixed. In node:13 we are running into it again. My mistake.

@Trott
Copy link
Member

Trott commented Jan 6, 2020

Sorry node:12 this issue was fixed. In node:13 we are running into it again. My mistake.

What exact version are you running? I'm not seeing the bug with Node.js 13.5.0.

@Trott
Copy link
Member

Trott commented Jan 6, 2020

The bug was in Node.js 13.0.0, but was fixed in Node.js 13.1.0. Are you running 13.0.x?

@simlu
Copy link

simlu commented Jan 7, 2020

Looks like circleci is still on an older node version for their docker container... So this is an issue we will need to get resolved with them. Sorry for the trouble and thank you for the quick help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants