Page 1 of 1

How to limit Regex to a particular drive?

Posted: Fri Mar 12, 2010 12:43 am
by Gerry
How do I limit Regex searches to a particular drive (or folder)?

For example, I can use ^[xyz] to search for files that begin with either X, Y or Z - but it displays files on *all* my drives.

How do I limit the results to C: (or C:\Users\)?

Using C:\ ^[xyz] returns *no* matches.

Thanks,
Gerry

Re: How to limit Regex to a particular drive?

Posted: Fri Mar 12, 2010 8:20 am
by void
Please enable Match Path from the Search Menu.

Please try the following search:

Code: Select all

^C:\\Users.*\\[xyz][^\\]*
^ = Match the start of the file name.
C:\\Users = Match the path C:\Users (use \\ to escape a single \).
.* = match any number of any character.
\\[xyz] = match a file name starting with xyz.
[^\\]* = match any character except a \.
$ = match the end of the file name.
Please note this will be slow.

You can do the same search instantly with the latest alpha release, regex disabled and with the following search:

Code: Select all

C:\Windows\\ !*\x*\* !*\y*\* !*\z*\* <\x | \y | \z>
C:\Windows = match files in c:\windows
*\x*\* !*\y*\* !*\z*\* = do not match sub folder and files of folder matches.
<\x | \y | \z> = File name starts with x, y or z.

I have not tested this with 1.2.1.371, it might work if you exclude the <> brackets.

Re: How to limit Regex to a particular drive?

Posted: Sat Mar 13, 2010 1:17 am
by Gerry

Code: Select all

^C:\\Users.*\\[xyz][^\\]*
Thanks for the reply.

I am not sure if the following is possible, but I would like to request the ability
to be able to mix normal search strings and regular expressions.

For example, I would like to be able to do something like this:

Code: Select all

c:\Users\ re:^[xyz]*
Of course, for the above to work, the ^ would have to be able to match the beginning
of each of the path elements and not only the very beginning of the path (which would always be C:\).

Anyway, thanks for a great program.

Gerry.

Re: How to limit Regex to a particular drive?

Posted: Sat Mar 13, 2010 9:43 am
by void
You will be able to mix and match regex and non-regex expressions in the next release of "Everything".

You can test this now with the latest alpha release.

The following search should work with the alpha release, with regex and match path disabled:
c:\Users\ regex:^[xyz]*