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

4 lines
150 B
TypeScript
Raw Normal View History

2022-12-28 11:35:27 +01:00
export function safeRegExp(pattern: string, flags?: string): RegExp {
return new RegExp(pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), flags);
}