I would like to add a certain number of leading zeroes to a number in a string. For example:
Input: "page 1", Output: "page 001" Input: "page 12", Ouput: "page 012" Input: "page 123", Ouput: "page 123"
What's the best way to do this with Regex.Replace?
At this moment I use this but the results are 001, 0012, 00123.
string sInput = "page 1";
sInput = Regex.Replace(sInput,@"\d+",@"00$&");