From 8dd8345d1498b8c6a3c6d7f7f4ebc600cfd2195b Mon Sep 17 00:00:00 2001 From: Joe Ibershoff Date: Thu, 14 Jan 2016 19:48:55 -0500 Subject: [PATCH] handle regex special characters --- debug.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debug.js b/debug.js index a21c0930..b475edcf 100644 --- a/debug.js +++ b/debug.js @@ -141,7 +141,7 @@ function enable(namespaces) { for (var i = 0; i < len; i++) { if (!split[i]) continue; // ignore empty strings - namespaces = split[i].replace(/\*/g, '.*?'); + namespaces = split[i].replace(/[\\^$+?.()|[\]{}]/g, '\\$&').replace(/\*/g, '.*?'); if (namespaces[0] === '-') { exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); } else {