From: "Hal E. Fulton" Date: 2000-11-07T13:14:44+09:00 Subject: [ruby-talk:6098] Regex question -- new("") vs. // Hello all... Why are these three patterns below not the same? Output I get is: yes 1 no 2 yes 3 And I know the pattern is ugly... I've been playing with it a lot to try to get it to include/exclude all the cases I want... Thanks, Hal float1 = Regexp.new("^(\d[\d_]*)*\.[\d_]*") float2 = /^(\d[\d_]*)*\.[\d_]*/ float3 = Regexp.new("^(\\d[\\d_]*)*\.[\\d_]*") test = "_123.45" if test =~ float1 puts "yes 1" else puts "no 1" end if test =~ float2 puts "yes 2" else puts "no 2" end if test =~ float3 puts "yes 3" else puts "no 3" end