P
Peter Bailey
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."
I thought that RUBY, like PERL, is inherently greedy and it would find
all instances of said regex expression.
Thanks a lot!
Peter
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."
I thought that RUBY, like PERL, is inherently greedy and it would find
all instances of said regex expression.
Thanks a lot!
Peter