> irb(main):001:0> puts
> "-123456789.01".gsub(/(\d)(?=\d{3}+(\.\d*)?$)/,'\1,')
> -123,456,789.01

    Whoops,

irb(main):001:0> puts
"-123456789.012345".gsub(/(\d)(?=\d{3}+(\.\d*)?$)/,'\1,')
-123,456,789.012,345


    How about:

irb(main):028:0> puts
"-123456789.123456789".gsub(/(\d)(?=\d{3}+(?:\.|$))(\d{3}\..*)?/,'\1,\2')
-123,456,789.123456789

    - Warren Brown