newNumber = number.gsub(/[^\d\.]/, '')
Or use gsub!
All the other methods don't account for stripping other garbage characters that people/exports might toss into strings. like () or - for negative nummbers.
Take the approach of extracting only what you want, not removing what you don't want.
"Balance: $ -(123,345.098) extra junk".gsub(/[^\d\.]/, '')
-- gw (www.railsdev.ws)