nobu.nokada / softhome.net writes:

> At Mon, 7 Jan 2002 13:18:12 +0900,
> Matt Armstrong <matt+dated+1010809088.372b5f / lickey.com> wrote:
>> I liked your idea at first, but this method is actually slower in my
>> case.  Why?  String#index with an offset does not support \A or ^ in
>> the regexp.
>
> Use \G instead.  \A always matches the beginning of the string.

Yes, this works, thanks.  Strangely, the "String#index with \G"
version is still a little bit slower than a version that keeps
chopping up the string with $POSTMATCH and using Regexp#~= with \A.
I'll have to investigate.

But the meaning of \G is not clear.  Matz' book says "match point
where last match finished" -- but for String#index that definition is
confusing.  Does \G for String#index just mean "anchor at beginning of
offset?"

-- 
matt