regexp-escaper
v1.0.2
Published
Regular expressions' special charaters escaper
Downloads
3
Maintainers
Readme
To install the package, run the following command
npm install --save regexp-escaper
This package helps to escape regular expressions' special characters in the text.
[ ] . * + ? ^ $ { } ( ) | \
Usage
import { regexpEscaper } from 'regexp-escaper'; // ES6 Module
const { regexpEscaper } = require('regexp-escaper'); // CommonJS
const text = "S.o\m[e(t]h)ing"
console.log(regexpEscaper(text)); // S\.om\[e\(t\]h\)ing