Welcome to the Mythicsoft Q&A site for:

- Agent Ransack
- FileLocator Lite
- FileLocator Pro

Please feel free to ask any questions on these products or even answer other community member questions.

Useful Links:

- Contact Us
- Help Manuals
- Mythicsoft Home

How do I search for a file name in the form "xxx NOT yyy"

0 votes

I have tried using Agent Ransack for a NOT boolean expression but couldn't get it to work.
Example I want to find all files with occurrences of cat excluding mat (cat NOT mat)

cat hat.txt
cat mat hat.txt
cat.txt
hat cat.txt
hat.txt
mat cat.txt
mat.txt

is this possible in AR ?

asked Sep 5, 2013 by user (1,570 points)

3 Answers

0 votes

Agent Ransack doesn't support Boolean expressions on the file name but you can achieve what you want, depending on which version of Agent Ransack you're running. See below.

FYI, FileLocator Pro DOES support Boolean expressions on the file name so you could do exactly what you describe, ie cat NOT mat

Agent Ransack 2014 (or higher)

With the new DOS Expression functionality you can use the format:

cat;NOT:mat

More information on the new syntax here:
Agent Ransack Help: DOS Expressions

Agent Ransack 2010 (or lower)

You'd need to use a some regex magic to achieve what you want. Using negative look behinds and look aheads this would work:

^(.(?<!mat))*cat(.(?!mat))*$

Don't forget to switch 'Regular expressions' on in the Options tab.

answered Sep 5, 2013 by dave (52,050 points)
0 votes

In Agent Ransack, the expression:

 cat;NOT:mat

gives the same result as:

 cat NOT mat

in Filelocator Pro, although this syntax is a little confusing as ; normally means OR, whilst : means AND in DOS expressions.

answered Jul 9, 2014 by bobm (1,050 points)

Good point, my answer was for Agent Ransack 2010. Agent Ransack 2014 added the ability to specify both inclusion and exclusion criteria.

0 votes

Not directly relevant to Agent Ransack / FLP, since they both have look behind functionality, but for regex engines that only have look ahead (eg javascript) the following works:

^(?!.*mat).*cat.*
answered Jul 1, 2015 by bobm (1,050 points)
...