On Thursday 30 September 2004 06:01,
wrote:
> At Thu, 23 Sep 2004 18:16:50 +0900,
> trans. (T. Onoma) wrote in [ruby-talk:113491]:
> > Curious, where's the offset? I can do this with String#index:
> >
> > str.index(/re/,offset)
> > $~.begin
> > $~.end
> >
> > But not with Regexp itself?
>
> $ ruby19 -ve 'p(/\s/.match(" abc def", 0).begin(0))'
> ruby 1.9.0 (2004-09-29) [i686-linux]
> 1
> $ ruby19 -ve 'p(/\s/.match(" abc def", 1).begin(0))'
> ruby 1.9.0 (2004-09-29) [i686-linux]
> 4
Wonderful Nobu.. This is a feature I always have needed without knowing it.
Thanks.
--
Simon Strandgaard