We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 40c9381 commit fd8be9fCopy full SHA for fd8be9f
src/util/match-index.js
@@ -1,13 +1,15 @@
1
// LICENSE : MIT
2
"use strict";
3
-
4
-var flagsGetter = require('regexp.prototype.flags');
+const flagsGetter = require('regexp.prototype.flags');
+const assert = require("assert");
5
/**
6
* @typedef {Object} MatchCaptureGroup
7
* @property {string} text - text is matched texts
8
* @property {number} index - index is start of match
9
*/
10
export function matchCaptureGroupAll(text, regExp) {
11
+ const source = regExp.source;
12
+ assert(source.indexOf("(") >= 0, "RegExp should contain capture group at least one");
13
const all = matchAll(text, regExp);
14
const captureGroups = [];
15
all.forEach(match => {
0 commit comments