From: Luis Parravicini Date: 2007-01-10T20:02:26+09:00 Subject: Re: Regex query On 1/10/07, Manoj P M wrote: > A Simple question on regular expression in ruby. Some can make me > understand the below code snippets. I was under the impression that > both these statement would give the same answer. But it doesnt. Why ? > > irb(main):001:0> 'banana' =~ /(an)*/ > => 0 In this case you are looking for '', 'an', 'anan', 'ananan' and so on. So it matches at the beginning of the string (index 0) with the empty string. Luis