perl - how to not match a pattern in xml -


log collector takes path collect log files. how omit "undo" files present in path4 directory.
collect logs path below omit undo files path4

<logs>       <log path="/path1/path2/path3/^[undo]*"/>   </logs> 

/path1/path2/path3/path4/undo1.txt
/path1/path2/path3/path4/undo2.txt

assuming tags log collector takes perl regular expression or it, it'd be:

<logs>       <log path="/path1/path2/path3/(?!undo)[^/]*"/>   </logs> 

(depending on whether log collector needs regular expression match whole file name, [^/]* @ end may not necessary)

unfortunately, name "log collector" bit generic, don't know software mean, don't know if in fact take perl regular expression; helpful give reference actual software using.


okay, here's that regular expression should match, using perl test program:

my $re = qr{/path1/path2/path3/(?!undo)[^/]*};  (<>) {   chomp;   if ($_ =~ $re) {     print "$_ matches\n"   } else {     print "$_ not match\n"   } } 

that shows us:

/path1/path2/path3/foo.txt matches /path1/path2/path3/bar.log matches /path1/path2/path3/undo_5.txt not match /path1/path2/path3/ matches 

this why wanted pointer software. because revised regex not work, "undo" files still getting pulled in, , tells me log software not match full filename regular expression, path (directory) name. can see evidence above regular expression not match files names beginning "undo".

and since want files in directory matched , not, should hope software has separate file= attribute accepts regular expression file names.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -