You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
10 lines
254 B
10 lines
254 B
2 years ago
|
// Thanks to Andrew Clover:
|
||
|
// http://stackoverflow.com/questions/3561493
|
||
|
// /is-there-a-regexp-escape-function-in-javascript
|
||
|
|
||
|
"use strict";
|
||
|
|
||
|
var re = /[-/\\^$*+?.()|[\]{}]/g;
|
||
|
|
||
|
module.exports = function (str) { return String(str).replace(re, "\\$&"); };
|