escapeRegExp.js 225 Bytes Raw Blame History Permalink 1 2 3 4 5 6 7 8 9 10 11 12 var toString = require('../lang/toString'); /** * Escape RegExp string chars. */ function escapeRegExp(str) { return toString(str).replace(/\W/g,'\\$&'); } module.exports = escapeRegExp;