From: John Sheahan Date: 2007-12-04T11:54:09+09:00 Subject: Re: Ruby regexp Match I got it! thanks to everyone that posted a reply....you all were very helpful! jackster Collins wrote: > John Sheahan wrote: >> >> I want to be able to do a kind of match like: >> >> m/^Title([a-zA-Z0-9])//g >> >> and access what's inside the () with x[0]. >> >> Thanks >> >> jackster >> > > Yes. > > irb(main):001:0> result = "Title1".match(/^Title([a-zA-Z0-9])/) > => # > irb(main):002:0> result[1] > => "1" > irb(main):003:0> $1 > => "1" > irb(main):004:0> Regexp.last_match[1] > => "1" > irb(main):005:0> $~[1] > => "1" > > > http://ruby-doc.org/core/classes/MatchData.html > > -Justin -- Posted via http://www.ruby-forum.com/.