Regex problem at start of line

Found a bug in "Everything"? report it here
Post Reply
bobm
Posts: 26
Joined: Fri Aug 21, 2015 11:27 am

Regex problem at start of line

Post by bobm »

There appears to be a problem with using exclusion matches at the start of a regex query.
Specifically, with regex enabled, searching for DR33 gives me the following matches:

Quote GDR336.pdf
Quote GDR337.pdf
DR33075.pdf

However, trying to eliminate those with G preceding the criteria by changing it to [^G]DR33 gives no matches when it should show DR33075.pdf (as confirmed by using regexpal.com)

This issue does not happen if the match is not at the start of the line, ie ABCDR33075.pdf is correctly matched.
void
Developer
Posts: 16771
Joined: Fri Oct 16, 2009 11:31 pm

Re: Regex problem at start of line

Post by void »

[^G] must match one character.
Since there is no character before DR3 in DR33075.pdf, the expression does not match.

Please try the regex search:

Code: Select all

([^G]|^)DR3
- Not G or start of filename, followed by DR3.
bobm
Posts: 26
Joined: Fri Aug 21, 2015 11:27 am

Re: Regex problem at start of line

Post by bobm »

OK. Thanks for the explanation.

http://www.regular-expressions.info/cha ... ml#negated explains the negated character class also matches line break characters and since (I presume) Everything doesn't consider these, it's a "gotcha" people need to be aware of.

FTR The online evaluator at http://regexr.com/3bmku shows what is being matched.
Post Reply