(regex: RegExp, input: string, group = 0)
| 54 | } |
| 55 | |
| 56 | export function getMatches(regex: RegExp, input: string, group = 0): string[] { |
| 57 | const matches: string[] = []; |
| 58 | let m: RegExpMatchArray | null; |
| 59 | while ((m = regex.exec(input))) { |
| 60 | matches.push(m[group]); |
| 61 | } |
| 62 | return matches; |
| 63 | } |
| 64 | |
| 65 | export function getMatchesWithOffsets(regex: RegExp, input: string, group = 0): Array<{text: string; offset: number}> { |
| 66 | const matches: Array<{text: string; offset: number}> = []; |
no test coverage detected