String#scan returns a two-dimensional array

You mean like this?

$VERBOSE = true

str = "Hello world"

# get first capture
str.slice(/Hello (.*)/, 1) #=> "world"
str[/Hello (.*)/, 1] #=> "world"
/Hello (.*)/.match(str)[1] #=> "world"
/Hello (.*)/ =~ str; $1 #=> "world"

# one dimensional array
/(.*) (.*)/.match(str).captures #=> ["Hello", "world"]

···

--
Posted via http://www.ruby-forum.com/.