Difference in behavior between * and \ in search

If you are experiencing problems with "Everything", post here for assistance.
Post Reply
leihu
Posts: 6
Joined: Wed Sep 10, 2025 5:27 am

Difference in behavior between * and \ in search

Post by leihu »

Dear Experts,

I ran into something I don’t understand when experimenting with * and \.

On my Desktop I created a folder called "First Level First". Inside it there are files and subfolders, and those subfolders may also contain files and further subfolders.

Now, when I search with these two queries:

\Desktop\*Level" "Fir*\
\Desktop\*Level" "Fir*


the results are very different.

However, when I change Fir* to First:

\Desktop\*Level" "First\
\Desktop\*Level" "First


the results are almost the same.

My understanding is that * should match any number of characters but not cross a backslash. So I would expect the results to be similar with or without the trailing backslash, but in practice they are not.

For reference:

I’m using Everything v1.5.

Both Match Path and Match whole filename when using wildcards are turned off in my settings.

Could someone explain why this happens?

Thanks in advance!
void
Developer
Posts: 19321
Joined: Fri Oct 16, 2009 11:31 pm

Re: Difference in behavior between * and \ in search

Post by void »

Everything matches the whole filename when using wildcards.

This can be disabled under Tools -> Options -> Search -> Match whole filename when using wildcards.



For Everything 1.5, "match whole filename when using wildcards" is really "match the whole sub-path".
The end of the filename must match.
Only the start of the sub path can shift, for example:
system32\*
will match
C:\windows\system32\foo

Everything will first try
system32\*
against
c:\windows\system32\foo
, then against
windows\system32\foo
, then finally
system32\foo

The whole sub path
system32\foo
matches.


\Desktop\*Level" "Fir*\
Normally, the trailing \ will not match anything.
No filenames end with \
So, instead of showing no results, Everything automatically adds
**


\Desktop\*Level" "Fir*\
=>
\Desktop\*Level" "Fir*\**




The \ prefix is also ignored.

\Desktop\*Level" "Fir*\
=>
Desktop\*Level" "Fir*\**



\Desktop\*Level" "Fir*
This will only look directly in desktop folders (not subfolders), for
*level" "fir*
leihu
Posts: 6
Joined: Wed Sep 10, 2025 5:27 am

Re: Difference in behavior between * and \ in search

Post by leihu »

Hi void,

First of all, thank you very much for your quick reply. Sorry for not responding earlier — I spent a few days carefully trying to understand your explanation.

I’ve only been using Everything for about two weeks. At first, I was very confused about its matching logic. Then I discovered two options: Match Whole Words and Match whole filename when using wildcards. After disabling both, I felt that Everything started to behave in a more “normal” way for me.

Later, I read a post by NotNull on the forum, and suddenly things made sense.
NotNull wrote: Wed Oct 12, 2022 8:33 pm Example with C:\Windows\notepad.exe

Usually, Everything checks only the part after the last backslash for matches.
This is the part you see in the Name column in Everything: notepad.exe.

So n* will find notepad.exe, whereas w* will not.

Everything can also search through the full filename (including path) for matches. In this case: C:\Windows\notepad.exe
This mode can be activated in a couple of ways:
- Enabling Match Path
- Specifying a \ in the search query
- Using ** wildcards
I tested many queries based on that explanation, and almost everything worked exactly as expected — until I ran into the issue I asked about the other day. Based on NotNull’s explanation (and my own understanding), I still cannot explain the results I am seeing.

So I’d like to confirm: is Everything’s matching process really as described in that post?

________________________________________


Regarding your comment about “Match whole filename when using wildcards”: I had already unticked this option before testing, so the first part of your explanation doesn’t really apply to my case. Still, I really appreciate you explaining it — this will be very helpful for my future learning.

After studying your reply carefully, I still find several points I cannot reconcile with my test results:

1. Trailing \
\Desktop\*Level" "Fir*\
Normally, the trailing \ will not match anything.
No filenames end with \
So, instead of showing no results, Everything automatically adds
**

Maybe internally you are indeed appending ** after the trailing \. However, from a theoretical point of view, a trailing \ should already be able to match any files whose full name contains this search fragment.

In practice, a trailing \ does match something. For example, \Desktop\ correctly matches all files and folders whose full path contains \Desktop\.

2. \ prefix

The \ prefix is also ignored.

\Desktop\*Level" "Fir*\
=>
Desktop\*Level" "Fir*\**

\Desktop\*Level" "Fir*
This will only look directly in desktop folders (not subfolders), for
*level" "fir*
But my tests show that the leading \ is not ignored. For example:
  • \Desktop\ only matches paths containing a directory named Desktop.
  • Desktop\ (without the leading slash) can match names like “My Desktop”.
Also, in the result list, the \ part is shown in bold, which suggests it is being taken into account.

3. Without the trailing \
\Desktop\*Level" "Fir*
This will only look directly in desktop folders (not subfolders), for
*level" "fir*
But my tests show that even without the trailing \, Everything will still list subdirectories and files under “First Level First”.

________________________________________


After running many different tests, I found that all of my questions eventually come down to one specific pattern that consistently produces results I cannot explain:

\Desktop\First*Level" "firs*


If I remove the first *, changing it to:

\Desktop\First" "Level" "firs*


then everything behaves as expected.

So my main question is: why does having two * in the query, with the second one at the very end, change the behavior so dramatically? Of course, in real usage, it’s rare that we would actually need two * like this.

Would you be able to clarify this behavior?

Thanks once again!
void
Developer
Posts: 19321
Joined: Fri Oct 16, 2009 11:31 pm

Re: Difference in behavior between * and \ in search

Post by void »

Example with C:\Windows\notepad.exe

Usually, Everything checks only the part after the last backslash for matches.
This is the part you see in the Name column in Everything: notepad.exe.

So n* will find notepad.exe, whereas w* will not.

Everything can also search through the full filename (including path) for matches. In this case: C:\Windows\notepad.exe
This mode can be activated in a couple of ways:
- Enabling Match Path
- Specifying a \ in the search query
- Using ** wildcards
So I’d like to confirm: is Everything’s matching process really as described in that post?
Yes, it's mostly correct.
However, Everything 1.5 doesn't match the full filename, instead it matches each sub-path part. (C:\Windows\notepad.exe AND windows\notepad.exe AND notepad.exe)
For example:
w*\n*
will C:\Windows\notepad.exe


Regarding your comment about “Match whole filename when using wildcards”: I had already unticked this option before testing, so the first part of your explanation doesn’t really apply to my case. Still, I really appreciate you explaining it — this will be very helpful for my future learning.
There's a bug here when "Match whole filename when using wildcards" is disabled.
A trailing * is causing the wildcard query to fail prematurely.
c:\windows\*tem* will not find files under c:\Windows\system32\ and it should be.
This will be fixed in the next alpha update.

Same applies to
\Desktop\*Level" "Fir*

-this is currently not finding files under "\desktop\First Level First\"

This issue applies only when you have two or more wildcard characters.
-A single trailing * is optimized away.


Maybe internally you are indeed appending ** after the trailing \. However, from a theoretical point of view, a trailing \ should already be able to match any files whose full name contains this search fragment.

In practice, a trailing \ does match something. For example, \Desktop\ correctly matches all files and folders whose full path contains \Desktop\.
Is there an issue here? Maybe I am missing something?
Everything should be matching your wildcard query anywhere in the path correctly when using a trailing \.

For example:
\Desktop\*Level" "Fir*\
will match files under "\desktop\First Level First\"


But my tests show that the leading \ is not ignored. For example:

\Desktop\ only matches paths containing a directory named Desktop.

Desktop\ (without the leading slash) can match names like “My Desktop”.
Disabling "Match whole filename when using wildcards" changes things.
The \ prefix is not ignored when disabling "Match whole filename when using wildcards".


3. Without the trailing \
\Desktop\*Level" "Fir*


This will only look directly in desktop folders (not subfolders), for
*level" "fir*
But my tests show that even without the trailing \, Everything will still list subdirectories and files under “First Level First”.
Do you mean it doesn't list subdirectories and files?
This is the bug mentioned above.
Do you see the expected results with:
\Desktop\*Level" "Fir**



So my main question is: why does having two * in the query, with the second one at the very end, change the behavior so dramatically? Of course, in real usage, it’s rare that we would actually need two * like this.
It's a bug when disabling "Match whole filename when using wildcards".
leihu
Posts: 6
Joined: Wed Sep 10, 2025 5:27 am

Re: Difference in behavior between * and \ in search

Post by leihu »

Hi void,

Thanks again for your detailed explanation. After going through your reply carefully and doing some more tests, I believe I now understand the matching behavior much better.

Your answers have really cleared up my confusion — I appreciate your patience and the time you spent helping me.
void
Developer
Posts: 19321
Joined: Fri Oct 16, 2009 11:31 pm

Re: Difference in behavior between * and \ in search

Post by void »

Everything 1.5.0.1400a fixes a search issue when using a trailing * wildcard.

c:\windows\*tem*
will now find files under
c:\Windows\system32
when "Match whole filename when using wildcards" is disabled.
ChrisGreaves
Posts: 807
Joined: Wed Jan 05, 2022 9:29 pm

Re: Difference in behavior between * and \ in search

Post by ChrisGreaves »

void wrote: Wed Sep 17, 2025 2:49 am Normally, the trailing \ will not match anything.
No filenames end with \
Thank you Void; this comment improves my knowledge of how Everything works.

I now think that Everything hunts for files that match the search string. When a file is found, the file's path can be shown, but the path wasn't found; only the file was found.

I have worded that poorly, but I think I had been expecting the simple search string to match a FullPath.

The FullPath can be matched, but the default operation is to find Files. not Folders.
(signed) "Still stumbling towards knowledge", of Bonavista.
Cheers, Chris
void
Developer
Posts: 19321
Joined: Fri Oct 16, 2009 11:31 pm

Re: Difference in behavior between * and \ in search

Post by void »

Normally, the trailing \ will not match anything.
No filenames end with \
This applies to using wildcards with "Match whole filename when using wildcards" enabled.

The trailing \ will still treat your search as a folder, only files/folders found under the specified folder are returned.
The trailing \ is still matched in the full path.
The search cannot match a file.



For example:

windows\system*\
matches c:\windows\system32\drivers

It cannot match a file named
C:\windows\system32
because the trailing \ is still matched.
Post Reply