1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-31 00:16:47 +01:00
unleash.unleash/src/lib/util/escape-regex.ts
2022-12-28 12:35:27 +02:00

4 lines
150 B
TypeScript

export function safeRegExp(pattern: string, flags?: string): RegExp {
return new RegExp(pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), flags);
}