Standardise leading zeroes in an input string Write a program in the shortest number of bytes possible that will parse any string given to it by input, and output that string with any and all numbers padded with leading zeroes to match the largest number's length.

For example:

Input:

This 104 is an -8 example of 4.518 a string 50.


The generated output should become:

This 104 is an -008 example of 004.518 a string 050.


Note that any digits after the period are not considered part of the "length" of a number. Numbers are considered any sequence of digits with either 0 or 1 periods in the sequence. Numbers will be delimited with either the string boundary, spaces, commas, or newlines. They can also be followed by a period, but only if the period is then followed by a delimiting character. They can also be preceded with a '-' to indicated negatives.  So something like this:

The strings 20.d, 5.3ft and &amp;450^ are not numbers, but 450.2 is.


Should output the following:

The strings 20.d, 5.3ft and &amp;450^ are not numbers, but 450.2 is.


That is to say, no modifications.

String input will be no more than 200 characters, if your program has an upper bound for some reason.

The winning answer will be the answer in the shortest number of bytes in seven days from the posting of this question.

Test cases

Input:

2 40 2


Output:

02 40 02


Explanation: both substrings 2 are bounded on one side by a string boundary and on the other side by  .



Input:

E.g. 2,2.,2.2,.2,.2., 2 2. 2.2 .2 .2. 2d 2.d 2.2d .2d .2.d 40


Output:

E.g. 02,02.,02.2,00.2,00.2., 02 02. 02.2 00.2 00.2. 2d 2.d 2.2d .2d .2.d 40


Explanation: in the first two groups the first four numbers are followed by a delimiter (, or  ) and the final one is followed by a period then a delimiter; in the third group, each sequence is followed by the non-delimiter d.
Ruby, 111 bytes

I hope this catches all the details of the spec

puts $*[0].gsub(r=/(?&lt;![^,\s])(-?)(\d+)(?=\.?\d*(?![^,\s]))/){$1+$2.rjust(i.scan(r).map{|m|m[1].size}.max,'0')}


It reads the input as the first command line argument and prints the result to STDOUT.