Skip to main content

Ported from https://github.com/sindresorhus/escape-string-regexp

escape-string-regexp

Build Status

Escape RegExp special characters

Usage

import { escapeStringRegexp } from 'https://raw.githubusercontent.com/Sab94/escape-string-regexp/master/mod.ts'

const  a = escapeStringRegexp('\\ ^ $ * + ? . ( ) | { } [ ]');
console.log(a)

//result: '\\\\ \\^ \\$ \\* \\+ \\? \\. \\( \\) \\| \\{ \\} \\[ \\]'

License

MIT