Page 1 of 1

Does search and replace allow numbers?

Posted: 19 Feb 2007 20:51
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??

Posted: 19 Feb 2007 21:40
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....

Posted: 19 Feb 2007 21:51
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?

Posted: 19 Feb 2007 21:57
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.

Posted: 19 Feb 2007 22:05
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.

Posted: 19 Feb 2007 22:12
by surrender
I am bad at regexp. how do i remove those 3 digits starting from 001 to 099 while retaining 101-199?

Posted: 19 Feb 2007 22:22
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

Posted: 19 Feb 2007 22:35
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.