#25 - fixed matches algorithm

This commit is contained in:
Simon Cambier
2022-04-30 20:18:26 +02:00
parent f2938cde88
commit ca04ed80c9
6 changed files with 42 additions and 34 deletions

View File

@@ -57,7 +57,7 @@ export function getAllIndices(text: string, regex: RegExp): SearchMatch[] {
}
export function stringsToRegex(strings: string[]): RegExp {
return new RegExp(strings.map(escapeRegex).join('|'), 'gi')
return new RegExp(strings.map(s => `(${escapeRegex(s)})`).join('|'), 'gi')
}
export function replaceAll(