Regex Question

General discussion related to "Everything".
Post Reply
Nash_B
Posts: 2
Joined: Wed Sep 15, 2021 5:42 am

Regex Question

Post by Nash_B » Wed Sep 15, 2021 5:45 am

I'm trying to pick the latest revision from a list of files with Void tool's "Search everything" program. Please help me to write a regex or similar. An example file list is named like below;

File1-Rev-A
File1-Rev-B
File2-Rev-A
File3-Rev-A
File3-Rev-B
File3-Rev-C

The results need to be the latest revision from each file, like below;

File1-Rev-B
File2-Rev-A
File3-Rev-C

I can't use other file attributes, as they are all the same for every file.

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

Re: Regex Question

Post by void » Wed Sep 15, 2021 6:28 am

I'm not 100% on the required constraints.
Do the filenames start with File?
Do the filenames have an extension?

Please try the following Everything search:

regex:File\d-Rev-[A-Z]

regex: = enable regular expressions.
File = match the literal string 'File'.
\d = match a single digit
-Rev- = match the literal string '-Rev-'
[A-Z] = match a single character A to Z.


The results need to be the latest revision from each file, like below;
This is trickier to do..
You will need Everything 1.5 alpha or later.

<regex:^File(\d)-Rev-A(.*)$ !file-exists:File\1-Rev-B\2 !file-exists:File\1-Rev-C\2> | <regex:^File(\d)-Rev-B(.*)$ !file-exists:File\1-Rev-C\2> | <regex:^File(\d)-Rev-C(.*)$>

Only Rev A-C is supported with the above.
Is there a Rev higher than C?

Nash_B
Posts: 2
Joined: Wed Sep 15, 2021 5:42 am

Re: Regex Question

Post by Nash_B » Wed Sep 15, 2021 9:33 am

Thank you so much for your time and very informative response Admin.

The last part of your answer was exactly what I wanted to know whether it was possible.

Now I have something to research.

Your software is amazing and I love every single bit of it.

Post Reply