Insert commas into numbers
Retina, 71 bytes

/[\d.,]+/_/\d/&amp;/\..*\./^&amp;(`,

^0+

^\B
0
'.&amp;`\.?0+$

/^\d+/_r`\B...
,$&amp;


Try it online! Link includes test cases. Explanation:

/[\d.,]+/_


Find all runs of digits, .s and ,s.

/\d/&amp;


Ignore those with no digits.

/\..*\./^&amp;


Ignore those with two .s.

(`


Process the rest of the script on each remaining match.

,


Delete all commas.

^0+


Delete all leading zeros.

^\B
0


Insert a leading zero if the number does not begin with a digit.

'.&amp;`


If the number contains a ....

\.?0+$


... delete trailing zeros and any preceding ..

/^\d+/_


On the part of the number before the ....

r`\B...
,$&amp;


Match groups of three starting from the end, but leave at least one digit at the beginning, and insert commas before each match.