On Thu, 2005-05-12 at 15:41, Patrick R. Michaud wrote:
>     $rule = rx :w / plane ::: (\d+) | train ::: (\w+) | auto ::: (\S+) / ;
>     $rule = rx :w /[ plane :: (\d+) | train :: (\w+) | auto :: (\S+) ]/ ;
> 
> On Thu, May 12, 2005 at 02:29:24PM -0400, Aaron Sherman wrote:
> > On Thu, 2005-05-12 at 13:44, Patrick R. Michaud wrote:

> > > False.  In the first case the group is the whole rule.  In the second
> > > case the group would not include the (implied) '.*?' at the start of
> > > the rule.

This was a very unfortunate choice of explanations, since an implied
".*?" would change the semantics of the match deeply. However, your
later explanation:

>     $r1 = rx /[abc :: def | ghi :: jkl | mn :: op]/;
> 
>     "abcdef"  ~~ $r1         # matches "abcdef"
>     "xyzghijkl" ~~ $r1       # matches "ghijkl"
>     "xyzabcghijkl" ~~ $r1    # matches "ghijkl"
> 
> Why does the last one match?  Because it fails the group but
> doesn't fail the rule -- i.e., the rule is still free to advance
> its initial pointer to the next character and try again. 

... is very understandable. Now I'm just left with a vague sense that I
never want to see anyone use :: :-)

-- 
Aaron Sherman <[EMAIL PROTECTED]>
Senior Systems Engineer and Toolsmith
"It's the sound of a satellite saying, 'get me down!'" -Shriekback


Reply via email to