From: Bil Kleb Date: 2006-08-15T07:50:09+09:00 Subject: regexp for finding floats in a string What RegExp should I be using for floats? Currently, I have /[-+0-9eE.]+/, viz, require 'test/unit' class TestFloatRegExp < Test::Unit::TestCase def test_finds_em %w{ 1 -2 3.0 0.4 5.0e+5 -6e+06 .7E+7 }.each do |string| assert( string.match(/[-+0-9eE.]+/), "no match >>#{string}<<" ) end end end -- Bil http://fun3d.larc.nasa.gov