UNPKG

payload

Version:

Node, React, Headless CMS and Application Framework built on Next.js

7 lines (6 loc) 302 B
/** * Escapes special characters in a string for use in a regular expression * @param string - The string to escape * @returns The escaped string safe for use in RegExp */ export const escapeRegExp = (string)=>string.replace(/[\\^$*+?.()|[\]{}]/g, '\\$&'); //# sourceMappingURL=escapeRegExp.js.map