Help To Find Files Which Have Characters twice or Thrice Or fourth

If you are experiencing problems with "Everything", post here for assistance.
Post Reply
NovaRanger
Posts: 7
Joined: Thu Jun 10, 2021 7:32 pm

Help To Find Files Which Have Characters twice or Thrice Or fourth

Post by NovaRanger » Thu Jun 10, 2021 7:50 pm

Hello,

I've been using Everything for almost 5 years now, and I thankful for this wonderful software.. Because I have a habit of Dumping files and then wondering where I kept.

My query is this,
I have files as follows.

Luffy.png
Luffy+Zorro.png
Luffy+Zorro+Nami.png
Luffy+Zorro+Nami+Usopp.png
And so on,
(these are character names and their position on the filename varies randomly).

Requirement is,
I want to list out all the files that have (cases as follows)
Case1: Have just one + in its name (shouldn't include two + )
Case2: Have just two + in its name ( shouldn't include three +)
Case3: Have just three + in its name (shouldn't include four +)

and so on...

I'm not sure if this is possible with just the standard search functionality in everything?

As for regex method,
For Case2
I tried

Code: Select all

\+.+?\+
This gives me matches allover the place,

Please tell me how I can achieve what I want.

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

Re: Help To Find Files Which Have Characters twice or Thrice Or fourth

Post by NotNull » Thu Jun 10, 2021 8:18 pm

The most straightforward way I can think of at the moment [1] to find filenames with exactly 2 + characters is without using regex:

Code: Select all

*+*+*   !*+*+*+*
Meaning filenames with at least 2 + without - the ! means NOT in Everything lingo - the ones with at least 3 +



With regex, to find filenames with exacly 2 + characters:

Code: Select all

regex:^([^\+]*\+[^\+]*){2}$


[1] I have the nagging feeling that there is an easier solution to this, but this is the best I can do at the moment
(and I hope it says something about this moment and not about me :))

NovaRanger
Posts: 7
Joined: Thu Jun 10, 2021 7:32 pm

Re: Help To Find Files Which Have Characters twice or Thrice Or fourth

Post by NovaRanger » Thu Jun 10, 2021 9:02 pm

Thanks for the quick reply,

Both works perfectly for me,
Particularly with the regex method I just have to change the number to get the list of files named with desired +

I have the nagging feeling that there is an easier solution to this, but this is the best I can do at the moment
(and I hope it says something about this moment and not about me :))
Nah mate,
First is, something that works, then optimizations;
is how every problem was solved, from evolution to programming ;)

Thanks I'll make a macro of the regex solution :)

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

Re: Help To Find Files Which Have Characters twice or Thrice Or fourth

Post by NotNull » Thu Jun 10, 2021 9:13 pm

Yeah, you are probably right: Perfect is the enemy of good. ..
(still hoping that someone posts a cleverer solution)
NovaRanger wrote:
Thu Jun 10, 2021 9:02 pm
Thanks I'll make a macro of the regex solution
In case you need some assistance, define a Filter as follows:

Code: Select all

Name = Number of +
Serach = regex:^([^\+]*\+[^\+]*){number:}$
Macro = +<number>
In the search bar, search for
+:2
to find filenames with exactly 2 +'s

NovaRanger
Posts: 7
Joined: Thu Jun 10, 2021 7:32 pm

Re: Help To Find Files Which Have Characters twice or Thrice Or fourth

Post by NovaRanger » Thu Jun 10, 2021 10:08 pm

Name = Number of +
Search = regex:^([^\+]*\+[^\+]*){number:}$
Macro = +<number>
In the search bar, search for
+:2
to find filenames with exactly 2 +'s

Thanks,
but this method doesn't seem to work for me..

Self analyzes:
I have the filter created exactly as you have written.
I check version, seems I was a bit off, downloaded newer version and ran it. Still doesn't work.

Starting tests with filters:

Code: Select all

Name: Test
Search: luffy
Macro: lu
Using lu: on search bar shows results of files with luffy,

Code: Select all

Name: Test2
Search: luffy variable:
Macro: lu<variable>
Using lu:zoro or lu:nami on search bar shows results of files with luffy & Zoro or luffy & Nami respectively,

Code: Select all

Name = Test3
Search = regex:{variable:}
Macro = plus<variable>
Using plus:3, now shows me results of all files with 3 somewhere in it's name..

(Testing with your regex idea, )

Code: Select all

Name = Test4
Search = regex:^([^\+]*\+[^\+]*){variable:}$
Macro = plus<variable>
Using plus:3, doesn't show anything

May be a bug in the software,
I'm guess the regex is complex enough that the software doesn't pass the variable or may be something.

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

Re: Help To Find Files Which Have Characters twice or Thrice Or fourth

Post by void » Thu Jun 10, 2021 10:18 pm

Butting in here, sorry..

Everything will allow you to use the same macro name in different filters.
However, only the first instance of the macro is used when called. (in your case it is most likely Test3)

Please try removing the older Test3 filter.

NovaRanger
Posts: 7
Joined: Thu Jun 10, 2021 7:32 pm

Re: Help To Find Files Which Have Characters twice or Thrice Or fourth

Post by NovaRanger » Thu Jun 10, 2021 10:25 pm

Well, hello there :)
Everything will allow you to use the same macro name in different filters.
However, only the first instance of the macro is used when called. (in your case it is most likely Test3)

Please try removing the older Test3 filter.
Well this is just for testing, I overwrote on each test,
So there is just one instance of the filter in actuality (apart from the ones that come by default in software)...

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

Re: Help To Find Files Which Have Characters twice or Thrice Or fourth

Post by void » Thu Jun 10, 2021 10:29 pm

Are any search options enabled under the search menu? please make sure regex is disabled.

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

Re: Help To Find Files Which Have Characters twice or Thrice Or fourth

Post by NotNull » Thu Jun 10, 2021 10:30 pm

Works here ..
(tested with an older version that I am toying with at the moment; newer versions should give the ssame results)

Right-click the statusbar and make sure only the Everything entry is enabled (other enabled entries are shown in the statusbar too; you can also double-click the to switch them off)



2021-06-11 00_19_35-Window.png
2021-06-11 00_19_35-Window.png (33.27 KiB) Viewed 861 times

NovaRanger
Posts: 7
Joined: Thu Jun 10, 2021 7:32 pm

Re: Help To Find Files Which Have Characters twice or Thrice Or fourth

Post by NovaRanger » Thu Jun 10, 2021 10:53 pm

Thanks for checking guys, :)

I cloned a fresh instance of the executable and tried the filter and it works,
So it was my bad, :roll:

by comparing ini,
I was able to narrow the reason it didn't work for me, down to Options > Search > Allow round bracket grouping.
If this is toggled on, the new filter idea doesn't work (well, the filter has brackets, so may be I should've left it be as out-of-the-box) :D

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

Re: Help To Find Files Which Have Characters twice or Thrice Or fourth

Post by void » Thu Jun 10, 2021 10:54 pm

Glad to hear Everything is working now.

This is one of the reasons 'Allow round bracket grouping' will be removed in Everything 1.5

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

Re: Help To Find Files Which Have Characters twice or Thrice Or fourth

Post by NotNull » Thu Jun 10, 2021 11:05 pm

I am partially to blame here too...

Usually I post regex queries with surrounding "" to prevent issues, amongst which the () grouping:

Code: Select all

search = regex:"^([^\+]*\+[^\+]*){variable:}$"
Forgot it this time.

Post Reply