JSPM

  • Created
  • Published
  • Downloads 53
  • Score
    100M100P100Q60180F
  • License MIT

ECMAScript proposed RegExp.escape.

Package Exports

  • regexp-escape-x

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (regexp-escape-x) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

regexp-escape-x

Travis status Dependency status devDependency status npm version

ECMAScript proposed RegExp.escape.

Requires ES3 or above.

See: RegExp.escape
Version: 1.3.0
Author: Xotic750 Xotic750@gmail.com
License: MIT
Copyright: Xotic750

module.exports(string)string

Method to safely escape RegExp special tokens for use in new RegExp.

Kind: Exported function
Returns: string - The escaped string.

Param Type Description
string string The string to be escaped.

Example

var regexpEscape = require('regexp-escape-x');
var str = 'hello. how are you?';
var regex = new RegExp(regexpEscape(str), 'g');
String(regex); // '/hello\. how are you\?/g'