hal9000 / hypermetrics.com writes:

>   str.gsub(/aeiou]/) { $&.upcase }
> 
> But suppose you didn't want to use $&, butt wanted to use a
> MatchData object md and reference md[0].

Well.. you can use the fact that $~ is set the the last MatchData
generated (which is the same as MatchData::last_match):

  "encyclopedia".gsub(/[aeiouy]/) { $~[0].upcase } # => "EncYclOpEdIA"


Regards


Dave