in reply to Dollars and regex cents

You don't need a regex, you need printf and the related sprintf:

printf '$%.2f', 5.5; #prints $5.50 printf '$%.2f', 9; #prints $9.00 printf '$%.2f', 19.95; # print $19.95

HTH