/** * Escape regexp special characters in `str`. * * @param {String} str * @return {String} * @api public */ module.exports = function(str){ return String(str).replace(/([.*+?=^!:${}()|[\]\/\\])/g, '\\$1'); };