unarray_file-tree-generator/src/utils/regex/regex.util.ts
2023-08-23 15:37:28 +02:00

3 lines
No EOL
153 B
TypeScript

export const escapeString = (string: string): string => {
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string
};