diff --git a/lib/watcher.js b/lib/watcher.js index f5de7e99b..9c55f6782 100644 --- a/lib/watcher.js +++ b/lib/watcher.js @@ -8,9 +8,9 @@ var DIR_SEP = require('path').sep; // Get parent folder, that be watched (does not contain any special globbing character) var baseDirFromPattern = function(pattern) { - return pattern.replace(/\/[^\/]*\*.*$/, '') // remove parts with * - .replace(/\/[^\/]*[\!\+]\(.*$/, '') // remove parts with !(...) and +(...) - .replace(/\/[^\/]*\)\?.*$/, '') || '/'; // remove parts with (...)? + return pattern.replace(/[\/\\][^\/\\]*\*.*$/, '') // remove parts with * + .replace(/[\/\\][^\/\\]*[\!\+]\(.*$/, '') // remove parts with !(...) and +(...) + .replace(/[\/\\][^\/\\]*\)\?.*$/, '') || DIR_SEP; // remove parts with (...)? }; var watchPatterns = function(patterns, watcher) {