12 lines
219 B
JavaScript
Raw Normal View History

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