Bug or Feature: Search/Replace Rename for Xx --> XX won't work with odd number of X's

Things you’d like to miss in the future...
Jerry
Posts: 696
Joined: 05 May 2010 15:48
Location: DysTrumpia

Bug or Feature: Search/Replace Rename for Xx --> XX won't work with odd number of X's

Postby Jerry » 17 Feb 2017 14:53

When there are an odd number of the same letter in a row, with all but the last letter uppercase, search and replace of "Xx" to "XX" does not change the last lowercase character. For example using the expression "Xx/XX" in Rename Special > Search and Replace,

    XXx-abx.txt does not change at all
    XXx-Xx-abx.txt changes to XXx-XX-ab.txt instead of XXX-XX-abx.txt
    XXXx-abx.txt changes to XXXX-abx.txt [ok]
    XXXXx-abx.txt does not change at all
    XXxxx-abx.txt changes to XXXXx-abx.txt instead of XXXXX-abx.txt
So if this is a feature and not a bug, I have to do one rename of Xx/XX for even counts and XXx/XXX for the odd counts?

[Using 17.50.0218]
Last edited by Jerry on 17 Feb 2017 16:21, edited 1 time in total.
Running on Windows 10 Pro 64-bit quad-core ASUS G752-VY notebook with 64 GB RAM, 20 or more external USB3 drives attached via 4 powered hubs, totaling 50+ TB.

admin
Site Admin
Posts: 42514
Joined: 22 May 2004 16:48
Location: Cologne, Win 8.1
Contact:

Re: Bug or Feature: Search/Replace Rename for Xx --> XX won't work with odd number of X's

Postby admin » 17 Feb 2017 15:41

Confirmed! Fascinating!! :ugeek: Going to work... :cup:

Gandolf
Posts: 1002
Joined: 14 Jun 2004 20:19

Re: Bug or Feature: Search/Replace Rename for Xx --> XX won't work with odd number of X's

Postby Gandolf » 17 Feb 2017 16:04

I don't totally agree with the last example.

I think that XXxxx-abx.txt should change to XXXxx-abx.txt, unless you are talking about a recursive replace.

I'm not on a system that will run XY at the moment so can't read the help file to see if the function is recursive by default.
Those people who think they know everything are a great annoyance to those of us who do.

admin
Site Admin
Posts: 42514
Joined: 22 May 2004 16:48
Location: Cologne, Win 8.1
Contact:

Re: Bug or Feature: Search/Replace Rename for Xx --> XX won't work with odd number of X's

Postby admin » 17 Feb 2017 16:10

Not as fascinating as I thought but simply a user error. For this to work the replacement should be case-sensitive!

It's done with a switch like this:

Code: Select all

Xx/XX /c


And Gandolf is right, XXxxx-abx.txt is renamed to XXXxx-abx.txt. All others end up with all capital Xs.

Jerry
Posts: 696
Joined: 05 May 2010 15:48
Location: DysTrumpia

Re: Bug or Feature: Search/Replace Rename for Xx --> XX won't work with odd number of X's

Postby Jerry » 17 Feb 2017 16:13

Gandolf wrote:I think that XXxxx-abx.txt should change to XXXxx-abx.txt, unless you are talking about a recursive replace.

Actually, I think I agree with you on that; not sure why I included that example.
Running on Windows 10 Pro 64-bit quad-core ASUS G752-VY notebook with 64 GB RAM, 20 or more external USB3 drives attached via 4 powered hubs, totaling 50+ TB.

Jerry
Posts: 696
Joined: 05 May 2010 15:48
Location: DysTrumpia

Re: Bug or Feature: Search/Replace Rename for Xx --> XX won't work with odd number of X's

Postby Jerry » 17 Feb 2017 16:20

admin wrote:All others end up with all capital Xs.

Without the /c switch, right?
Running on Windows 10 Pro 64-bit quad-core ASUS G752-VY notebook with 64 GB RAM, 20 or more external USB3 drives attached via 4 powered hubs, totaling 50+ TB.

admin
Site Admin
Posts: 42514
Joined: 22 May 2004 16:48
Location: Cologne, Win 8.1
Contact:

Re: Bug or Feature: Search/Replace Rename for Xx --> XX won't work with odd number of X's

Postby admin » 17 Feb 2017 16:40

No, with the switch.
Attachments
2017-02-17_163944.png
2017-02-17_163944.png (10.17 KiB) Viewed 132 times

Jerry
Posts: 696
Joined: 05 May 2010 15:48
Location: DysTrumpia

Re: Bug or Feature: Search/Replace Rename for Xx --> XX won't work with odd number of X's

Postby Jerry » 17 Feb 2017 17:42

Are you saying there is no bug here afterall?
Running on Windows 10 Pro 64-bit quad-core ASUS G752-VY notebook with 64 GB RAM, 20 or more external USB3 drives attached via 4 powered hubs, totaling 50+ TB.

highend
Posts: 6016
Joined: 06 Feb 2011 00:33

Re: Bug or Feature: Search/Replace Rename for Xx --> XX won't work with odd number of X's

Postby highend » 17 Feb 2017 17:47

There isn't.
One of my scripts helped you out? Please donate via Paypal or highend (at) web (dot) de

Jerry
Posts: 696
Joined: 05 May 2010 15:48
Location: DysTrumpia

Re: Bug or Feature: Search/Replace Rename for Xx --> XX won't work with odd number of X's

Postby Jerry » 17 Feb 2017 18:16

Ok, I guess the rule to remember here is that the string matching proceeds from left to right with no overlapping. So the "Xx" matches the first XX, takes those 2 characters out of consideration for further matching and moves along. This is also the way Notepad does its case-insensitive search and replace too.

But it does seems surprising initially to see the string "Xx" appear in a name and find that the basic case-insensitive search and replace may not work on it, if that string does not appear in isolation from other "X's". Understandable, but surprising.

Case closed.
Running on Windows 10 Pro 64-bit quad-core ASUS G752-VY notebook with 64 GB RAM, 20 or more external USB3 drives attached via 4 powered hubs, totaling 50+ TB.


Return to “Bug Reports”



Who is online

Users browsing this forum: No registered users and 4 guests