From: nobu.nokada@...
Date: 2004-08-23T07:33:18+09:00
Subject: Re: Regexp scanning with MatchData (Re: multiple regexp matches)
Hi,
At Sun, 22 Aug 2004 14:00:45 +0900,
Austin Ziegler wrote in [ruby-talk:110110]:
> Proposal:
> String#scan, #sub, and #gsub
> yield MatchData objects instead of Strings. I think that this could be
> achieved while breaking the least amount of code by adding a #to_str
> implementation to MatchData.
#to_str doesn't solve everything. MatchData#[] returns a matched
portion for sub-patterns, whereas String#[] returns a byte at
the position.
--
Nobu Nakada