Ninety-nine Pitchers of Malt
Miss any of our Open RFC calls?Watch the recordings here! »

regex-escape

3.2.0 • Public • Published

regex-escape Support this project

Escapes input characters to be used in regular expressions.

Installation

$ npm i regex-escape

Example

// Dependencies
var RegexEscape = require("regex-escape");
 
console.log(RegexEscape("{#/}"));
// => \{#\/\}

Documentation

RegexEscape(input)

Escapes a string for using it in a regular expression.

Params

  • String input: The string that must be escaped.

Return

  • String The escaped string.

proto()

Adds the RegexEscape function to RegExp class.

Return

  • Function The RegexEscape function.

How to contribute

Have an idea? Found a bug? See how to contribute.

Thanks

Big thanks to CoolAj86 for posting this answer. This library uses the black magic regex from that answer. ✨

Where is this library used?

If you are using this library in one of your projects, add it in this list. ✨

License

MIT © Ionică Bizău

Keywords

Install

npm i [email protected]

Version

3.2.0

License

MIT

Last publish

Collaborators

  • avatar