In message <87lmfb6j8h.fsf / squeaker.lickey.com>
matt+dated+1010799012.80728c / lickey.com writes:

> This is mainly because the Regexp#match matches on the whole string,
> so if you want to match starting at an arbitrary position, you must
> create a substring.  Parsing a large string this way can create a lot
> of intermediate copies of the same string, stressing memory use.

Then you can use String#index(regexp, offset).  Eg:

    s = "foobarbaz"
    p s.index(/ba/, 0) #=> 3
    p s.index(/ba/, 3) #=> 3
    p s.index(/ba/, 6) #=> 6


-- 
kjana / dm4lab.to                                January 7, 2002
Youth comes but once in a lifetime.