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
0 votes

For a file containing the text below, I want to match all instances of DR33 that are not preceded by G by using [^G]DR33. For example, assume I have three files:

Quote GDR336.pdf
Quote GDR337.pdf
DR33075.pdf

In this instance I would expect it to find one file (ie DR33075.pdf) but FLP7.5 finds no matches. This issue does not happen if the match is not at the start of the line, ie ABCDR33075.pdf is correctly matched.

by (905 points)

1 Answer

0 votes
 
Best answer

The issue is that your expression is requiring a preceding character but in the instance above there isn't one since the pattern is at the beginning of the file name. So you actually want to match DDR3 when it's not preceded by G OR the start of the text. Try this instead:

(^|[^G])DR33

The ^ matches the beginning of the line.

by (29.5k points)
OK thanks.
Several of the online regex evaluators show my criteria working as expected but only one showed that the [^G] was matching the previous linefeed character.
If you were relying on multi-line regex behavior it still wouldn't work if the DR33075.pdf were the first item in the list (ie no preceeding LF).
Good point.  Thanks.
...