The problem with this approach is that regexs don't have any understanding of the length of captured text. If you had a part of your pattern like
\.(\d+)\.
the digits will be captured into the match group but there is no way you can tell how many digits there are within the regex engine itself. All you could do is to have your program get the match group text from the regex engine and manipulate it using the programming languages string functions (or convert it to an integer and then back to a formatted string with the leading zeros added).
Perhaps because of its history, regex engines are heavily biased towards using a pattern to locate text - the ability to manipulate and replace text extracted using the pattern is very much the poor cousin in this regard.
Susan