Everything Rename globbing error

Found a bug in "Everything"? report it here
Post Reply
therube
Posts: 5056
Joined: Thu Sep 03, 2009 6:48 pm

Everything Rename globbing error

Post by therube »

Everything Rename (1351)


is this right?

source:
cancersurvivorspark281560
cancersurvivorspark171547
cancersurvivorspark161548
cancersurvivorspark151546
cancersurvivorspark141544

old: cancersurvivorspark%115%2
new: cancersurvivorspark%115%2 - park%1

renamed:
cancersurvivorspark281560 - park28.jpg
cancersurvivorspark171547 - park17.jpg
cancersurvivorspark161548 - park16.jpg
cancersurvivorspark151546 - park.jpg
cancersurvivorspark141544 - park14.jpg


shouldn't 151546 have ended up at 15 ?



same results with regex: (still missing, 15)?

old: ^cancersurvivorspark(.*?)15(.*?)$
new: cancersurvivorspark\115\2 - park\1
.
Everything Rename Globbing Bug15.png
Everything Rename Globbing Bug15.png (39.92 KiB) Viewed 7291 times
NotNull
Posts: 5517
Joined: Wed May 24, 2017 9:22 pm

Re: Everything Rename globbing error

Post by NotNull »

When 'normal' Everything search replace is activated (as in your first example), the %1 syntax uses lazy matching (expressed in regex terminbology)

So for filename cancersurvivorspark151546, old syntax cancersurvivorspark%115%2 will search for the first 15 after cancersurvivorpark and calls that %1. In this case cancersurvivorpark and 15 are right beside each other, making %1=<nothing>



In the regex example,
.*?
(lazy) matches zero or more characters, making the first capture group (.*?) empty.
Which causes \1 to be empty.

This can be solved for this specific case by using (.+?) instead of (.*?) for the first capture group as
.+
matches one or more characters:

Code: Select all

OLD = ^cancersurvivorspark(.+?)15(.*?)$

(all untested, btw)
therube
Posts: 5056
Joined: Thu Sep 03, 2009 6:48 pm

Re: Everything Rename globbing error

Post by therube »

I'll just note that the regex: version I show above, is what was Everything came up with, by default.

And with that (.+) [at \1] looks to be OK.
Post Reply