Skip to main content
Deno 2 is finally here 🎉️
Learn more

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