Peter Bailey wrote:
> Hi,
> I've been learning RUBY the past 7 months or so, and, now, my assistant
> is doing the same. In her perusal of the "Programming RUBY" book, first
> edition, she's come across a simple, simple regex truism that throws
> her, and throws me, too!
> 
> Why is this true?
> 
> "banana" =~ /an*/
> =>1
> 
> This is driving me nuts. Why isn't the RUBY response "=>2?" There are
> two "an" stubs in "banana."
The number returned is the position of the start of match, not the 
number of them.

> I thought that RUBY, like PERL, is inherently greedy and it would find
> all instances of said regex expression.
It is...  there's only one match, and it matches everything from the 
first 'a' to the end of the string.

Hope this makes sense,
-- 
Alex