diff --git a/lib/util.js b/lib/util.js index b2bfa7c5ddd56b..2dc2259338f9a3 100644 --- a/lib/util.js +++ b/lib/util.js @@ -81,7 +81,8 @@ exports.debuglog = function(set) { debugEnviron = process.env.NODE_DEBUG || ''; set = set.toUpperCase(); if (!debugs[set]) { - if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { + if (isFunction(RegExp) && + new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { var pid = process.pid; debugs[set] = function() { var msg = exports.format.apply(exports, arguments);