From: Szymon tichy Date: 2007-09-19T05:20:09+09:00 Subject: Re: converting text Hi group (my first post here). Imo it is only moderately close to perfection ;) ["10.001%", "r00t", "hax0r", "#x80C and #x670"].map do |string| string.gsub(/\d+(\.\d+)?/) {|match| "%.1f" % match} end ==> ["10.0%", "r0.0t", "hax0.0r", "#x80.0C and #x670.0"]