I have an algorithm that takes multiple full paths of files and verifies that each of them is 'banned' by the server.
The var s
of for
refers to each of these paths and sets
is an array with regular expressions to check.
array
I want to only probify aq and aq4, all will be probidios ... hence the term needs to be exact.
I also could not use Regex literal with value of sets[s]
so I want to know how to do this using constructor syntax.
var sets = ['contatos/aq', 'contatos/aq4'];
for(var s=0; s < sets.length; s++) {
var comst =
if( new RegExp(sets[s]).test(path_p) ) { // se arquivo for proibido pelo sets...
if(testheader.test(read) && testfooter.test(read)){
read = read.replace(testheader, '');
read = read.replace(testfooter, '');
fs.writeFileSync(totxt, read);
}
fs.renameSync(totxt, path_p);
return false;
}
}