Using regex to add leading zeroes
- by hgpc
I would like to add a certain number of leading zeroes (say up to 3) to all numbers of a string. For example:
Input: /2009/5/song 01 of 3
Output: /2009/0005/song 0001 of 0003
What's the best way to do this with regular expressions?