Robert Klemme <shortcut... / googlemail.com> wrote:
> > In this solution, temp substring is created every time.
> > If input string is long, it is not efficient.
>
> This is not true.  Creating a substring is fairly cheap because the
> character buffer is not copied (copy on write).

You are right. If input string is not modified, creating substring
doesn't copy anything.
Creating substring may be the solution I wanted.


> > I'm going to propose to support start position in Regexp#match().
>
> For the time being it's faster to use one of the other alternatives.
> Also, with the new regexp engine in 1.9 your feature might be present
> already.

I found that Regexp#match() can take optional 2nd argument which
specifies matching start position in Ruby1.9. Good news.

Thank you, Robert.

--
makoto kuwata