[#3228] Core support for Gems, and namespace — "Luke A. Kanies" <luke@...>

Hi all,

21 messages 2004/07/27
[#3230] Re: Core support for Gems, and namespace — Austin Ziegler <halostatue@...> 2004/07/27

On Tue, 27 Jul 2004 11:39:08 +0900, Luke A. Kanies <luke@madstop.com> wrote:

[#3234] Re: Core support for Gems, and namespace — "Luke A. Kanies" <luke@...> 2004/07/27

On Tue, 27 Jul 2004, Austin Ziegler wrote:

[#3238] Re: Core support for Gems, and namespace — Austin Ziegler <halostatue@...> 2004/07/27

On Wed, 28 Jul 2004 00:14:29 +0900, Luke A. Kanies <luke@madstop.com> wrote:

Re: Trying to understand \G

From: nobu.nokada@...
Date: 2004-07-17 05:05:51 UTC
List: ruby-core #3203
Hi,

At Sat, 17 Jul 2004 11:28:40 +0900,
Yukihiro Matsumoto wrote in [ruby-core:03200]:
> |I'm being silly again, but I can't get \G to work with String.index. If 
> |I run the following, it loops writing out 0,a,0,a,0,a...
> 
> '\G' only works for repeating match methods, String#gsub, String#scan,
> etc.

Or when starting position is given.

  last = 0
  while index = words.index(PATT, last)
    puts index
    puts $&
    last = Regexp.last_match.end(0)
  end

BTW, assignment to `last' at the end of the loop annoys me, it'd be nicer
if I can write as:

  last = 0
  while match = words.match(PATT, last)
    puts match.begin(0)
    puts match.to_s
    last = match.end(0)
  end

-- 
Nobu Nakada

In This Thread