escapeRegex.js 198 B

1234567891011
  1. 'use strict';
  2. const internals = {};
  3. module.exports = function (string) {
  4. // Escape ^$.*+-?=!:|\/()[]{},
  5. return string.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g, '\\$&');
  6. };