You are not logged in.
Pages: 1
Hi
I have a bunch of files that are named with a string of "text" + "-"+a number+".extension"
The number does not have leading zeroes so the files appear in the wrong order
text-1.ext
text-10.ext
text-100.ext
text-101.ext
And I want
text-001.ext
text-002.ext
text-003.ext
etc
So I want to replace
"text-?.ext" with "text-00?.ext" and
"text-??.ext" with "text-0??.ext"
But it seems ? is not allowed in the replace part of a rule
So how can I pad out the numbers with leading zeros?
TFAI
On a more general note, it would. IMHO, be very useful to be able to use ? and * in the replace part where they refer to the character(s) that they replaced in the find part of the command.
Offline
You can use the Padding rule to apply the zero padding to existing numbers.
See https://www.den4b.com/wiki/ReNamer:Rules:Padding
Regarding the second question. You can enable an option to interpret wildcards and back-references in the Replace rule.
Offline
Padding: That's very clever. I thought it only applied to numbers being added. Silly thought really as that is in serialise
Not sure I get backreferences
I'll have a play and see if I can work it out
Thx
Offline
So I want to replace
"text-?.ext" with "text-00?.ext" and
"text-??.ext" with "text-0??.ext"
That would be:
"text-?.ext" with "text-00$1.ext" and
"text-??.ext" with "text-0$1$2.ext"
With wildcards and back-references in the Replace rule.
Offline
Thank you.
And if I have understood it correctly,
TextABCD-1.ext -> TextABCD-001.ext
TextADCB-1.ppt-> TextCDAB-001.ppt
TextZZ-2.xls -> TextZZ-002.xls
TextXXX-13 .txt -> TextXXX-0013.txt
can all be done with
Find Text*-?.*
Replace Text$1-00$2.$3
with wildcards and backrefs ticked
Offline
And if I have understood it correctly,
TextABCD-1.ext -> TextABCD-001.ext
TextADCB-1.ppt-> TextCDAB-001.ppt
TextZZ-2.xls -> TextZZ-002.xls
TextXXX-13.txt -> TextXXX-0013.txtcan all be done with
Find Text*-?.*
Replace Text$1-00$2.$3
with wildcards and backrefs ticked
The first 3 examples should work, but the 4th example will not.
"TextXXX-13.txt" will not match the "Text*-?.*" pattern, because "?" matches exactly 1 character.
This is where you should start using Regular Expressions instead of Wildcards.
Offline
Pages: 1