1 (edited by daffdaemon 2014-03-01 20:58:47)

Topic: Change length of # at end of filename

The help file gives the following example:
From :                 To:
Img1.jpg             Img_001.jpg
Img2.jpg             Img_002.jpg
Img10.jpg           Img_010.jpg

Use the expression :
Img_%N.%e or Img_%N{3}.%e

The following expression will work with any filename which has # at end of the name:
%b(s/(\d+$)//i)%N{3,,-1}.%e

Example:
anyfilename-2.jpg                =>  anyfilename-002.jpg
Any.filename34.jpg              =>  Any.filename034.jpg
Any17_filename_12.jpg       =>  Any17_filename_012.jpg

Obviously use any desired values in the %N expression.

To add a separator, put desired character between the RegEx  & the %N:
%b(s/(\d+$)//i)_%N{3,,-1}.%e
%b(s/(\d+$)//i)-%N{3,,-1}.%e

To remove a separator, put undesired separator before the \d:
%b(s/(_\d+$)//i)%N{3,,-1}.%e
%b(s/(-\d+$)//i)%N{3,,-1}.%e

To change the separator, do both (note: there is a space between _ and ~)
%b(s/([-_ ~.]\d+$)//i)_%N{4,,-1}.%e
ie:
Filename-1.jpg         =>   Filename_0001.jpg 
Filename_20.jpg       =>  Filename_0020.jpg
Filename 300.jpg      =>  Filename_0300.jpg
Filename~4000.jpg   =>  Filename_4000.jpg
Filename.050.jpg      =>  Filename_0050.jpg