Tapatalk

How to find a phrase in file contents while omitting specific phrases?

How to find a phrase in file contents while omitting specific phrases?

2

PostMar 26, 2019#1

What I want to find in the file content: 'eat at joe'
But I additionally want these results omitted: 'eat at joes diner because it'
So my results would only contain text such as: 'eat at joe street cafe on the...'

Basically how do I add a NOT qualifier (or equivalent) to my UltraFinder file contents search?

6,824625
Grand MasterGrand Master
6,824625

PostMar 26, 2019#2

This can be done with a Perl regular expression search using negative lookaheads and lookbehinds.

For the examples the regular expression search string is eat at joe(?!s diner because it) using a negative lookahead.

2

PostMar 26, 2019#3

That works great! Thanks, Mofi.

I am accustomed to another software that has multi-field boolean, I had never used or attempted Perl before.

Addition for that solution for anyone else that finds this post:

If I was looking to find the phrase: eat at joe
But I wanted to omit: eat at joe"
Meaning that I didn't want to see entries where the word joe was immediately followed by a double quote.
The search string I used was: eat at joe(?!")
It caused many false positives in .zip files and graphical image files.
So I added this to the 'ignore files/types:' field: *.zip;*.gif;*.png;*.jpg;*.swf;*.ico;*.eot;*.woff;*.ttf;*.icc;*.psd;*.woff2;*.svg;*.svg2;*.;*.svgz;
To get a clean result list, omitting the false positives from zip and image files.
You'll want to review the omitted file types yourself in lieu of a quick copy/paste.
Hope this helps the next person.