1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-11-01 19:07:38 +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);
}