On Fri, 14 May 2004 23:21:27 +0900
ts <decoux / moulon.inra.fr> wrote:

> >>>>> "S" == Simon Strandgaard <neoneye / adslhome.dk> writes:
> 
> S> ts <decoux / moulon.inra.fr> wrote:
> S> [snip] 
> >> What do you expect with ?
> >> 
> >> /(.*).*/ =~ "abc"
> 
> S> According to the left-most-longest rule.. I would guess the output
> S> should be ["abc", "abc"].. 
> 
>  Then you have make .* match *twice* :-)
> 
>  If the regexp can't match the empty string in the second .* (because it's
>  included in the first), it must not give a result

I don't understand you here.. (maybe your assumption is wrong) ?


Lets break it down

1)  The left-most .* will first eat to the end of input, and will now contain "abc".
    Then it hits end of input.

2)  the left-most .* backtracks one time

3)  The right-most .* eats to end of input... it now contains ""

4)  the left-most .* backtracks one time

5)  Done.

-- 
Simon Strandgaard