Great! That does it. Thanks. :)
I realized my error on the anchors after sending... but didn't think of the * 
on the grouping. 

On the & operator... are you saying that it would operate basically as 
expected... allowing sets of rules and'ed rather than or's with the | ?




--- Phil

-----Original Message-----
From: Moritz Lenz [mailto:mor...@faui2k3.org] 
Sent: August 10, 2010 2:09 PM
To: Beauchamp, Philippe (6009210)
Cc: perl6-language@perl.org
Subject: Re: regex and

Hi,

philippe.beauch...@bell.ca wrote:
> rule TOP
> {
>                 ^
>                 [
>                 & <alpha>*
>                 & <!abc>
>                 ]
>                 $
> }

The & syntax is specced, but it's not yet implemented in Rakudo.

But note that <!abc> is a zero-width assertion, so your example regex
matches at the start of a string, if it does not begin with 'abc'.

Since you anchor it to the end of string too, it can only ever match the
empty string.

You can achieve the same with just ^$.

If you want to match an alphabetic string which does not include 'abc'
anywhere, you can write this as

^ [ <!abc> <alpha> ]* $

Cheers,
Moritz

Reply via email to