[Solved] Searching files with characters in specific locations

Discussion related to "Everything" 1.5 Alpha.
Post Reply
w64bit
Posts: 253
Joined: Wed Jan 09, 2013 9:06 am

[Solved] Searching files with characters in specific locations

Post by w64bit »

If I do this search in 1.4:
?ac?.jpg
I obtain correct results.
In 1268a there are other files listed, with "ac" not in the same location of the file name.
Also, in search list there are files with more than 4 characters.
Last edited by w64bit on Fri Jan 21, 2022 3:29 pm, edited 1 time in total.
void
Developer
Posts: 16753
Joined: Fri Oct 16, 2009 11:31 pm

Re: Searching files with characters in specific locations

Post by void »

What search options are checked under the Search menu?

Could you please give an example filename where ac is not in the same location.
w64bit
Posts: 253
Joined: Wed Jan 09, 2013 9:06 am

Re: Searching files with characters in specific locations

Post by w64bit »

Nothing selected + Everything filter.
Example for: ?ac?.jpg
1ac2.jpg (OK)
anythingac4.jpg (not OK)

It seems that ? from the end it's respected. The first ?, not.
Last edited by w64bit on Wed Jul 07, 2021 8:06 am, edited 1 time in total.
void
Developer
Posts: 16753
Joined: Fri Oct 16, 2009 11:31 pm

Re: Searching files with characters in specific locations

Post by void »

There is a Tools -> Options -> Search -> Match whole filename when using wildcards option.

Please try checking this option. (it should be checked by default)
w64bit
Posts: 253
Joined: Wed Jan 09, 2013 9:06 am

Re: Searching files with characters in specific locations

Post by w64bit »

Yes. Thank you.
w64bit
Posts: 253
Joined: Wed Jan 09, 2013 9:06 am

Re: Searching files with characters in specific locations

Post by w64bit »

Is it possible to add a secondary checkbox to Options -> Search -> Match whole filename when using wildcards,
named "For names using only ?".

If checked can work like this:

3 letter docx in folders starting with one character + ABC + anything
\?ABC*\ ???.docx
Last edited by w64bit on Thu Jul 08, 2021 8:32 am, edited 2 times in total.
void
Developer
Posts: 16753
Joined: Fri Oct 16, 2009 11:31 pm

Re: Searching files with characters in specific locations

Post by void »

I will consider an option to only match whole words when using (?)
Thank you for the suggestion.

For now, please use the wfn: (Whole File Name) search modifier:

\?ABC*\ wfn:???.docx

(works best with match whole filename when using wildcards disabled)

In Everything 1.5:

?ABC*\???.docx

-or-

?ABC**\???.docx

(works best with match whole filename when using wildcards enabled)
(Everything 1.5 will check each subpath, instead of the whole path)

In other words, Everything 1.5 will test:
c:\docs\my docs\xABC123\foo.docx => No Match
c:\docs\my docs\xABC123\foo.docx => No Match
c:\docs\my docs\xABC123\foo.docx => No Match
c:\docs\my docs\xABC123\foo.docx => Match

In Everything 1.4 (or 1.5):

*\?ABC*\???.docx

(prefix the search with a * to match the start of the path)
(works best with match whole filename when using wildcards enabled)
w64bit
Posts: 253
Joined: Wed Jan 09, 2013 9:06 am

Re: Searching files with characters in specific locations

Post by w64bit »

Thank you very much.
One remark. In addition to this new option, maybe "Match whole filename when using wildcards" can be moved from Options to Search menu as "Match filename".
void
Developer
Posts: 16753
Joined: Fri Oct 16, 2009 11:31 pm

Re: Searching files with characters in specific locations

Post by void »

I will consider a Match Whole Filename option under the Search menu.

Thank you for the suggestion.
gregor.al
Posts: 7
Joined: Tue Apr 13, 2021 7:57 am

Re: Searching files with characters in specific locations

Post by gregor.al »

This is a great feature for special cases.
RegEx has special characters for this purpose ( anchors ).

Caret (^) matches the position before the first character in the string.
Dollar ($) matches the position right after the last character in the string.

Perhaps adding/using those two might be easier and more generic?

Just an idea, ignore if it is not a good fit.
void
Developer
Posts: 16753
Joined: Fri Oct 16, 2009 11:31 pm

Re: Searching files with characters in specific locations

Post by void »

You can enable the special regex characters ^ and $ for use in a normal search with Everything 1.5.

To enable matching of the start of the filename with a caret:
  • In Everything, type in the following search and press ENTER:
    /match_start_of_filename_with_caret=2
    where 2 is match start of basename, 1 is match start of filename (or full path when match path is enabled) and 0 is off (default).
    If successful you should see match_start_of_filename_with_caret=1 in the status bar for a few seconds.

To enable matching of the end of the filename with a dollar sign:
  • In Everything, type in the following search and press ENTER:
    /match_end_of_filename_with_dollar_sign=1
    where 1 is on and 0 is off (default).
    If successful you should see match_end_of_filename_with_dollar_sign=1 in the status bar for a few seconds.

Match end of filename with dollar sign
Match start of filename with caret
w64bit
Posts: 253
Joined: Wed Jan 09, 2013 9:06 am

Re: Searching files with characters in specific locations

Post by w64bit »

@ void
Can you please tell me if this feature (automatically detect ? and *) is at the top of your list?
void
Developer
Posts: 16753
Joined: Fri Oct 16, 2009 11:31 pm

Re: Searching files with characters in specific locations

Post by void »

What feature are you referring to?
w64bit
Posts: 253
Joined: Wed Jan 09, 2013 9:06 am

Re: Searching files with characters in specific locations

Post by w64bit »

Everything should automatically detect ? and * without user intervention (without wfn: or Match whole filename when using wildcards).

FOLDER1 containing:
1.pdf
12.pdf
123.pdf

Problem 1:
Match whole filename when using wildcards = OFF
\FOLDER?\ ?.pdf
all files in folder are listed

Problem 2:
Match whole filename when using wildcards = ON
\FOLDER?\ ?.pdf
\FOLDER?\ *.pdf
no files are listed

I think that:
\FOLDER?\ ?.pdf should display 1 character filenames
\FOLDER?\ *.pdf should display all filenames
Last edited by w64bit on Tue Aug 03, 2021 10:14 am, edited 1 time in total.
void
Developer
Posts: 16753
Joined: Fri Oct 16, 2009 11:31 pm

Re: Searching files with characters in specific locations

Post by void »

The intended usage with "Match whole filename when using wildcards" = ON is:
folder?\?.pdf
folder?\*.pdf

or, if you want subfolders under folder1:

folder?\** ?.pdf
folder?\** *.pdf
folder?\**.pdf



Since a trailing backslash will never match anything with "Match whole filename when using wildcards" = ON, I will experiment with matching whole basenames anywhere in the parent path.

For example:
\window?\ would match c:\windows\Notepad.exe

This would make your following searches work as expected with "Match whole filename when using wildcards" = ON:
\FOLDER?\" ?.pdf should display 1 character filenames
\FOLDER?\" *.pdf should display all filenames



With "Match whole filename when using wildcards" = OFF, please try the following search:
\FOLDER?\" \?.pdf
void
Developer
Posts: 16753
Joined: Fri Oct 16, 2009 11:31 pm

Re: Searching files with characters in specific locations

Post by void »

Everything 1.5.0.1271a adds support for matching wildcards with a trailing path separator anywhere in the path.

For example:

\FOLDER?\

is treated as:

\FOLDER?\**


This works best when "Match whole filename when using wildcards" is enabled from Tools -> Options -> Search.

The leading path separator can also be omitted:

FOLDER?\
w64bit
Posts: 253
Joined: Wed Jan 09, 2013 9:06 am

Re: Searching files with characters in specific locations

Post by w64bit »

Excellent. It's much, much easier now.
Thank you very much.
Post Reply