From: Peter Hickman Date: 2011-02-19T00:20:48+09:00 Subject: Re: Help for extracting text with regexp. You know what they say, if you choose to use a regex you've got another problem :( How about this? a = "foo.bar/somePath/somepage.php?attr=value&theone=64646hs554&other=ddd" a.split(/\?|&/).each do |b| if b =~ /^theone=(.*)/ puts $1 end end