问题描述
我想看,文件夹中的变化:
- test/index.js
- te3st/index.js
但没有变化
- te2st/index.js 不是任何 teNUMBERst/index.js
我使用 chokidar 并从这里获得灵感:chokidar
使用 ignored: ignored: /^.*\b(?:(?!te2st\/index\.js)\w)+\b$/
可以使用 regEx,但我的 regEx 没有按预期工作 (regex how to exclude specific characters or string anywhere)。
这个正则表达式在这里工作: https://regex101.com/r/XnKYcf/1/
var chokidar = require('chokidar');
var watcher = chokidar.watch('/home/replays/0.0.24/t*t/index.js',{ignored: /^.*\b(?:(?!te2st\/index\.js)\w)+\b$/,persistent: true});
watcher
.on('add',function(path) {console.log('File',path,'has been added ');})
.on('change','has been changed ');})
.on('unlink','has been removed ');})
.on('error',function(error) {console.error('Error happened',error);})
那是在这里还不能正常工作的广告否定定义。允许通过正则表达式会更实用且更易于阅读。这可能吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)