Use regex, but limit responses to a particular drive, or list of drives

If you are experiencing problems with "Everything", post here for assistance.
Post Reply
Meroveus
Posts: 1
Joined: Thu Jul 22, 2021 2:46 pm

Use regex, but limit responses to a particular drive, or list of drives

Post by Meroveus » Thu Jul 22, 2021 3:09 pm

I generally have regex enabled all the time, but for some searches, it would be nice to limit responses to a single drive.

I used advanced search and it gave me the search string

Code: Select all

parent:d: regex:wow[0-9]+
but that returned nothing

This did:

Code: Select all

d:\ regex:wow[0-9]+
That's fine for 1 drive, but is there any way to say "not c:\"

btw the above is a contrived example just for testing.

horst.epp
Posts: 483
Joined: Fri Apr 04, 2014 3:24 pm

Re: Use regex, but limit responses to a particular drive, or list of drives

Post by horst.epp » Thu Jul 22, 2021 4:54 pm

!c: your_search_for_all_other_here

Mizufluffy
Posts: 20
Joined: Sun Jun 13, 2021 10:22 am

Re: Use regex, but limit responses to a particular drive, or list of drives

Post by Mizufluffy » Thu Jul 22, 2021 5:00 pm

If I'd like to limit search to a single drive I'd use

Code: Select all

path:"C:"
(I have a habit of enclosing path in " and " because it works well also with full paths even with spaces in the path)

If I'd want to exclude one drive then I'd use NOT operator (!) and would do

Code: Select all

!path:"D:"
Quoting Everything Search Syntax for parent function:
"Search for files and folders in the specified path, excluding subfolders."
If you use

Code: Select all

parent:D:
then it will only show files that are directly under root path of D drive.
In your case, it seems there were no files or folders that matched your regex.

So, if you want to say "find files and folders matching this regex, 'wow[0-9]+', from all drives but not C drive", then this should work:

Code: Select all

!path:"C:" regex:"wow[0-9]+"

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

Re: Use regex, but limit responses to a particular drive, or list of drives

Post by NotNull » Thu Jul 22, 2021 7:47 pm

I get the confusion. When regex is enabled (Menu:Serach > Enable Regex ), search modifiers and -functions are seen as search text and loose their original meaning.

A full regex way (Enable Regex is enabled):
^[^c]:\\
- Search on all drives except C:
^[^cde]:\\
- Search on all drives except C: D: and E:
^[^d-w]:\\
- Search on all drives except D: through W: ( = A B C X Y Z )
^[cde]:\\
- Search only on drives C: D: and E:


When Enable Regex is inactive, you can use
!D: | !E: regex:abc
to search for abc on all drives except D: and E:
(as already mentioned. ! is Everything-speak for NOT; see the Search Syntax Help )

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

Re: Use regex, but limit responses to a particular drive, or list of drives

Post by void » Thu Jul 22, 2021 10:49 pm

Disabling pure regex is also available in Everything 1.5

When pure regex is disabled and Regular Expressions are enabled from the Search menu you can use the Everything syntax and Everything functions with regex:

!^c:


Note: spaces and | will need to be escaped with double quotes.

Post Reply