mirror of
https://github.com/debug-js/debug.git
synced 2026-01-18 16:12:38 +00:00
Merge pull request #250 from zacronos/master
handle regex special characters
This commit is contained in:
commit
0682a14c16
2
debug.js
2
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 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user