This isn't really what you are going to want:

````
1.9.3p0 :002 > "a\n1" =~ /^(\d)/
 => 2
1.9.3p0 :003 > $1
 => "1"
1.9.3p0 :004 > "a\n1".to_f
 => 0.0
1.9.3p0 :005 >
````