Fixed a crash

This commit is contained in:
Simon Cambier
2022-05-02 18:36:33 +02:00
parent 228e410592
commit cb84f109c0
3 changed files with 1 additions and 5 deletions

View File

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