You are not logged in.
abc - #000 - defghijklmnop.pdf
abcdefghijklmnop -#001.pdf
abcdefghijklm - #002 - nop.pdf
#003 - abcdefghijklmnop.pdf
It's like I want to search for the numbers part and increase by 1.
Offline
Too complicated?
OK, the same question without the "zero padding":
abc - #0 - defghijklmnop.pdf
abcdefghijklmnop -#1.pdf
abcdefghijklm - #2 - nop.pdf
#3 - abcdefghijklmnop.pdf
how to solve this?
Does anyone know if regular expressions support search and replace manipulation.
Offline
abc - #000 - defghijklmnop.pdf
abcdefghijklmnop -#001.pdf
abcdefghijklm - #002 - nop.pdf
#003 - abcdefghijklmnop.pdfIt's like I want to search for the numbers part and increase by 1.
FROM:
abc - #000 - defghijklmnop.pdf
abcdefghijklmnop -#001.pdf
abcdefghijklm - #002 - nop.pdf
#003 - abcdefghijklmnop.pdf
TO:
abc - #001 - defghijklmnop.pdf
abcdefghijklmnop -#002.pdf
abcdefghijklm - #003 - nop.pdf
#004 - abcdefghijklmnop.pdf
TRY:
this PascalScript ( https://www.den4b.com/wiki/ReNamer:Rules:PascalScript )
(* Find a literal #-sign plus three digits and increase the number *)
(* https://www.den4b.com/forum/viewtopic.php?pid=12067#p12067 *)
var
//Parts: TStringsArray;
Parts: TWideStringArray;
Part: WideString;
PartsLen: Integer;
begin
Parts := SubMatchesRegEx(FileName, '(.*)(#\d\d\d)(.*)', FALSE);
If (Length(Parts) = 3)Then
begin
Part := Parts[1];
Part := WideTrimChars(Part,'#');
PartsLen := Length(Part);
// do the math here:
Part := IntToStr(StrToInt(Part) + 1 );
//
//pad number to original length:
while Length(Part) < PartsLen do
Part:='0'+Part;
//
Part:= '#' + Part;
//WideShowMessage(Parts[0] + Part + Parts[2]);
End;
FileName := Parts[0] + Part + Parts[2];
end.
Or for any length of number exchange
Parts := SubMatchesRegEx(FileName, '(.*)(#\d\d\d)(.*)', FALSE);
by
Parts := SubMatchesRegEx(FileName, '(.*)(#\d+)(.*)', FALSE);
FROM:
#003 - abcdefghijklmnop.pdf
#3 - abcdefghijklmnop.pdf
abc - #0 - defghijklmnop.pdf
abc - #000 - defghijklmnop.pdf
abcdefghijklm - #002 - nop.pdf
abcdefghijklm - #2 - nop.pdf
abcdefghijklmnop -#001.pdf
abcdefghijklmnop -#1.pdf
TO:
#004 - abcdefghijklmnop.pdf
#4 - abcdefghijklmnop.pdf
abc - #001 - defghijklmnop.pdf
abc - #1 - defghijklmnop.pdf
abcdefghijklm - #003 - nop.pdf
abcdefghijklm - #3 - nop.pdf
abcdefghijklmnop -#002.pdf
abcdefghijklmnop -#2.pdf
Read the *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)
Offline
It works. Thank you very much.
Offline