Does search and replace allow numbers?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
surrender
Posts: 623
Joined: 23 Oct 2005 08:53
Location: Berlin, Germany

Does search and replace allow numbers?

Post by surrender »

i was trying to search and replace some filenames with numbers to some other number. Does search and replace allow this??

eg:

filename001, filename002, ..... until filename099 or so.

and replace it with say,

filename100, filename101, ..... until filename199 .

any idea how to do with search and replace??

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Post by jacky »

This is not doable using S&R, since you're not really searching/replacing anything here (or you'd need one for 001/100, another one for 002/101, etc)

But you can do that using increments, select the files and use filename<#100> to do it.
Or course it means all files share the same basename, ie you don't want to have somefile100.txt and otherfile101.txt

If you actually have different basenames, it's a bit more complicated. Sure the wildchar * allow to keep the basename, but you actually want to change it here (since you mean to change a number with another one, and that (original) number is part of the basename, obviously)

Sadly you can't use increments with regexp (to my knowledge), otherwise it'd be pretty easy. If all basenames are different you can simply remove the numbers, but otherwise it's gonna be a bit more complicated I think....
Proud XYplorer Fanatic

j_c_hallgren
XY Blog Master
Posts: 5826
Joined: 02 Jan 2006 19:34
Location: So. Chatham MA/Clearwater FL
Contact:

Post by j_c_hallgren »

Just a wild idea...could it be done in two passes? So that fn001, fn002 becomes (as interim) fn001100, fn002101, etc. (or fn001.100 style) via incrementing and then the next pass would remove the original seq nbr, leaving the new one?
Still spending WAY TOO much time here! But it's such a pleasure helping XY be a treasure!
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Post by jacky »

j_c_hallgren wrote:Just a wild idea...could it be done in two passes? So that fn001, fn002 becomes (as interim) fn001100, fn002101, etc. (or fn001.100 style) via incrementing and then the next pass would remove the original seq nbr, leaving the new one?
Absolutely, IF all original numbers are the same the same length! Then using * with increment will keep them in, but you can remove them after using regexp indeed.
Proud XYplorer Fanatic

surrender
Posts: 623
Joined: 23 Oct 2005 08:53
Location: Berlin, Germany

Post by surrender »

Thanks JC, but the problem is "search and replace" will not allow wildcard for numbers for removing 001, 002, 003 ... 099 in one go.
I am a bit confused, maybe there is a simple way.

Update: I dont know why but out of logic i was trying ###/<#101>. I know thats kind of my stupid way. I mixed batch rename with search and replace.

surrender
Posts: 623
Joined: 23 Oct 2005 08:53
Location: Berlin, Germany

Post by surrender »

I am bad at regexp. how do i remove those 3 digits starting from 001 to 099 while retaining 101-199?

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Post by jacky »

surrender wrote:I am bad at regexp. how do i remove those 3 digits starting from 001 to 099 while retaining 101-199?
hmm... you mean with names like filename001101.ext and filename002102.ext and so on, right?

Then this should do it: (Will remove the 3 first numbers found on the filename)

Code: Select all

(.*?)[0-9]{3}(.*)>$1$2
Proud XYplorer Fanatic

surrender
Posts: 623
Joined: 23 Oct 2005 08:53
Location: Berlin, Germany

Post by surrender »

Thanks Jacky, that worked. Regexp saved again.

Actually, i by mistake renamed my files to 001 instead of 101 and could not undo this mistake. Therefore ended into this situation. But i know XY isnt a renaming utility and therefore keep "Lupasrename" handy just in case.

Post Reply