We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7fea476 commit c4a83e7Copy full SHA for c4a83e7
src/xregexp.js
@@ -1408,9 +1408,6 @@ fixed.exec = function(str) {
1408
}
1409
1410
// Attach named capture properties
1411
- if (XRegExp.isInstalled('namespacing')) {
1412
- match.groups = undefined;
1413
- }
1414
if (this[REGEX_DATA] && this[REGEX_DATA].captureNames) {
1415
let groupsObject = match;
1416
if (XRegExp.isInstalled('namespacing')) {
@@ -1425,6 +1422,9 @@ fixed.exec = function(str) {
1425
1422
groupsObject[name] = match[i];
1426
1423
1427
1424
+ // Preserve any existing `groups` obj that came from native ES2018 named capture
+ } else if (!match.groups && XRegExp.isInstalled('namespacing')) {
+ match.groups = undefined;
1428
1429
1430
// Fix browsers that increment `lastIndex` after zero-length matches
0 commit comments