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

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);
}