From: "Peña, Botp" Date: 2007-01-31T11:10:35+09:00 Subject: Re: Regexp captures On Behalf Of El Gato: # (c = result.match(/id: (\d+)/)) ? c.captures.first : # result.scan(/error: (.*)/).to_s why not just build the regex and then capture/match. irb(main):067:0> re = /(id|error): ((\d+)|(.*))/ => /(id|error): ((\d+)|(.*))/ irb(main):068:0> result = "id: 1234" => "id: 1234" irb(main):069:0> c = result.match(re)[2].to_s => "1234" irb(main):070:0> result = "error: this is an error" => "error: this is an error" irb(main):071:0> c = result.match(re)[2].to_s => "this is an error" kind regards -botp