I am trying to create a regular expression that turns a string like "5+.34+3", into "5+0.34+3". Basically I am trying to add a leading zero in front of all decimals that DON'T have a leading zero already.
Some Examples
Input | Output | Change |
---|---|---|
".34" | "0.34" | (added zero in front of decimal) |
"1.45" | "1.45" | (No change) |
"66+.33+22+.32" | "66+0.33+22+0.32" | (added zero in front of all decimals without one |
"5+.22" | "5+0.22" | (added zero in front of .22) |
Thank you so much for trying to figure this out!
(If there is another question on stack overflow like this one, please let me know so I can take this question down)