Padding numbers

A place to try and solve your RegEx problems.
Post Reply
ebulerdo
Posts: 18
Joined: Mon Dec 09, 2013 8:54 am

Padding numbers

Post by ebulerdo »

I have a list with files whose names contain a number. This number can be two, three or four digits. I need to convert that number in four digits, adding zeroes to the left if necessary.

For example, I need to convert IMG_560.jpg into JPG0560. Actually it's a bit more complex but this is the core of the issue.

So far I am doing it in three steps, once for two digit numbers, then three digit, then four digit. Is there a way to convert them all at once?

Thanks!
Post Reply