On 12/4/07, John Sheahan <contact / thirdorder.net> 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].

ruby gives more (objects), see http://ruby-doc.org/core/classes/MatchData.html

some simple examples

t="Title123asdf"
#=> "Title123asdf"
/^Title([a-zA-Z0-9])/.match(t)
#=> #<MatchData:0x28b7b60>
/^Title([a-zA-Z0-9])/.match(t)[0]
#=> "Title1"
/^Title([a-zA-Z0-9])/.match(t)[1]
#=> "1"
$~
#=> #<MatchData:0x28afc94>
$~[0]
#=> "Title1"
$~[1]
#=> "1"
x=/^Title([a-zA-Z0-9])/.match(t)
#=> #<MatchData:0x28a8598>
x[0]
#=> "Title1"
x[1]

kind regards -botp