Add zero for numbers 1-9 to so all are are two digits

A swapping-ground for Regular Expression syntax

Add zero for numbers 1-9 to so all are are two digits

Postby RobertfJk8 » Thu Apr 02, 2015 5:25 am

Hello i recently found out this particular great software as well as i had been expecting somebody might tell us the best way to put irrespective inside the file name the particular 1-9 numbers are a actually zero and so file1. ext is going to be file01. ext or maybe file 1. ext is going to be file 01. ext appreciate it.





______________________________________________________________________________________________
NoorAlamShahzad
RobertfJk8
 
Posts: 1
Joined: Thu Apr 02, 2015 5:16 am

Re: Add zero for numbers 1-9 to so all are are two digits

Postby bitmonger » Thu Apr 02, 2015 3:59 pm

Not sure what you're asking, but it looks like you want to place a zero in front of the digit 1-9 in the position next to the extension dot.
Use
RegEx (1)
Include Ext. NOT checked

Match
(.*)([1-9])$
Replace
\10\2

This will match the numbers 1-9 and won't match 0 or a non number.
It matches
file1 .ext becoming file01.ext
file 1.ext becoming file 01.ext

Does NOT match file0.ext or file.ext

However it does match
file 21.ext becoming file 201.ext

If you don't want it to match any filenames having more than a single number at the end of the filename then change the
Match to
(.*\D)([1-9])$

Hope this helps,
Bit
bitmonger
 
Posts: 50
Joined: Sat Sep 22, 2007 5:05 am


Return to Regular Expressions


cron