(re: RegExp, str: string)
| 13 | const nonCapturingGroupRe = new RegExp(escapeRegexSpecialChars(nonCapturingGroup), 'g'); |
| 14 | |
| 15 | const occurencesInString = (re: RegExp, str: string) => { |
| 16 | const matches = str.match(re); |
| 17 | re.lastIndex = 0; |
| 18 | return matches ? matches.length : 0; |
| 19 | }; |
| 20 | |
| 21 | const anyGroupRe = new RegExp( |
| 22 | `${escapeRegexSpecialChars(nonCapturingGroup)}|${escapeRegexSpecialChars(capturingGroup)}`, |