1const ESCAPE_RE = /[/\-\\^$*+?.()|[\]{}]/g; 2 3export const escapeRegex = (str: string) => { 4 return str.replace(ESCAPE_RE, '\\$&'); 5};