Hi,

In message "[ruby-talk:6867] Equivalent to Perl's /g and pos()?"
    on 00/12/07, "Ben Tilly" <ben_tilly / hotmail.com> writes:

|An obvious "solution" is to walk through the string making a
|copy of what is left at each step.  However doing that turns
|what should be a O(n) scan through a string into O(n*n) work
|due to recopying the string - which I find unacceptable.
|
|This should be an easy thing to add to Ruby.  Just have a
|method that returns where the last match left off, and to the
|match operator add a second optional argument which is the
|position in the string to start looking for a match at.  Add
|a \G modifier like Perl's to indicate that the match must
|start exactly at that position or fail.

I'm afraid I don't get your point, but String#scan or String#index
might satisfy your request?  In addition, Ruby's regex already have \G
which works along with String#{scan,gsub,index}.

							matz.