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: \"pa
string sInput = "page 1"; //sInput = Regex.Replace(sInput, @"\d+", @"00$&"); string result = Regex.Replace(sInput, @"\d+", me => { return int.Parse(me.Value).ToString("000"); });