diff options
Diffstat (limited to 'server/helpers/regexp.ts')
-rw-r--r-- | server/helpers/regexp.ts | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/server/helpers/regexp.ts b/server/helpers/regexp.ts deleted file mode 100644 index 257054cea..000000000 --- a/server/helpers/regexp.ts +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | // Thanks to https://regex101.com | ||
2 | function regexpCapture (str: string, regex: RegExp, maxIterations = 100) { | ||
3 | const result: RegExpExecArray[] = [] | ||
4 | let m: RegExpExecArray | ||
5 | let i = 0 | ||
6 | |||
7 | while ((m = regex.exec(str)) !== null && i < maxIterations) { | ||
8 | // This is necessary to avoid infinite loops with zero-width matches | ||
9 | if (m.index === regex.lastIndex) { | ||
10 | regex.lastIndex++ | ||
11 | } | ||
12 | |||
13 | result.push(m) | ||
14 | i++ | ||
15 | } | ||
16 | |||
17 | return result | ||
18 | } | ||
19 | |||
20 | export { | ||
21 | regexpCapture | ||
22 | } | ||