mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
6 lines
216 B
TypeScript
6 lines
216 B
TypeScript
// Helper to sanitize / escape special chars for passing to RegExp-constructor
|
|
|
|
export function escapeRegExp(str: string) {
|
|
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
|
|
}
|