regex: confusion

If you are experiencing problems with "Everything", post here for assistance.
Post Reply
NotNull
Posts: 2335
Joined: Wed May 24, 2017 9:22 pm

regex: confusion

Post by NotNull » Thu Oct 01, 2020 8:34 am

regex:"(a)\1"
finds filenames containing an "a", followed directly by another "a", so xyzaa123.txt would match.

why doesn't
regex:(a)\1
- the same regex, but without the "" - give the same results?


Added to that:
With Enable Regex activated (Menu:Search),
(a)\1
finds the "aa" files, whereas
:"(a)\1"
gives zero results.
Last edited by NotNull on Thu Oct 01, 2020 8:49 am, edited 2 times in total.

void
Site Admin
Posts: 5732
Joined: Fri Oct 16, 2009 11:31 pm

Re: regex: confusion

Post by void » Thu Oct 01, 2020 8:39 am

regex:(a)\1 appears to work OK here.

Is Tools -> Options -> Search -> Allow round bracket grouping enabled?

What is shown in the debug console after you perform this search?

NotNull
Posts: 2335
Joined: Wed May 24, 2017 9:22 pm

Re: regex: confusion

Post by NotNull » Thu Oct 01, 2020 8:56 am

void wrote:
Thu Oct 01, 2020 8:39 am
Is Tools -> Options -> Search -> Allow round bracket grouping enabled?
:shock: Yes!!
I have no idea why that setting was enabled. I don't use it as it can only give unpredictable results (and here is the proof of that .. ) so I didn't even bother to check the setting.

I think it is time to start with a clean INI.

Mystery solved. Thanks!!

raccoon
Posts: 97
Joined: Thu Oct 18, 2018 1:24 am

Re: regex: confusion

Post by raccoon » Fri Oct 16, 2020 4:59 pm

To round out this post, can someone identify all of the characters and symbols that are specially parsed by Everything keyword searches and would require quotation for `regex:`?

void
Site Admin
Posts: 5732
Joined: Fri Oct 16, 2009 11:31 pm

Re: regex: confusion

Post by void » Sat Oct 17, 2020 12:46 am

Everything search terms use the following syntax:

! prefix = NOT
space = AND
| = OR
< and > = Grouping

You can escape these special characters with double quotes (").

For example:

Everything will interpret:
regex:gr(a|e)y
as:
regex:gr(a OR e)y
note: gr(a is no longer a complete regex term and e)y is no longer a regex term.

regex:foo bar
as:
regex:foo AND bar
note: bar is no longer a regex term.


regex:!foo
as:
NOT regex:foo

This might not be what you expect.

With double quotes, Everything will interpret:
regex:"gr(a|e)y"
as the regular expression:
gr(a|e)y


Eating the | when using the regex: search modifier is in development.

If you want pure regex syntax, enable Match Regex from the Search menu.

Post Reply