i want watch, changes in the folders:
- test/index.js
- te3st/index.js
but not changes in
- te2st/index.js not any teNUMBERst/index.js
i using chokidar and got inspiration from here: chokidar
with ignored: ignored: /^.*\b(?:(?!te2st\/index\.js)\w)+\b$/
its possible to use regEx, but my regEx did not work like expected ( regex how to exclude specific characters or string anywhere ).
this regex working here : 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', function(path) {console.log('File', path, 'has been changed ');})
.on('unlink', function(path) {console.log('File', path, 'has been removed ');})
.on('error', function(error) {console.error('Error happened', error);})
that is the ad negativo definition that does not yet work properly here. Allowing via regex would be much more practical and easier to read. is this possible?
this Answer not use the ignore Attribute really. It allows almost anything at first and then filters later. maybe it's easier to read as a solution with the ignore attribute, i haven't been able to implement it with that.
output of
$ node /home/x/0.0.24/file-watcher.js
: