Lei Wu wrote: > Hi, > > I want to translate the following Perl code into Ruby: > > @captures = ($text =~ /company=(.+)/g) > > Basically, the Perl version uses the g modifier to capture all > occurrence of the matches in () and put them into an array. > > How do I do this in Ruby? match_data = text.match( /company=(.+)/ ) # see [0] You can then treat your MatchData [1] object like an array and access matches like: match_data[0] HTH, Zach [0] - http://www.ruby-doc.org/core/classes/String.html#M001335 [1] - http://www.ruby-doc.org/core/classes/MatchData.html