On Sun, Feb 20, 2005 at 10:46:15PM +0100, Eirik Berg Hanssen wrote:
> Eirik Berg Hanssen <[EMAIL PROTECTED]> writes:
> > Rod Adams <[EMAIL PROTECTED]> writes:
> >> $re1 = /^ <-[x]>* x <-[x]>* $/; # match a string with exactly one 'x'
> >> $re2 = /^ <-[y]>* y <-[y]>* $/; # ditto 'y'
> >> $re3 = /^ <-[z]>* z <-[z]>* $/; # ditto 'z'
>
> >> $re7 = none($re1, $re2, $re3); # matches if there are 0 or 2+ of
> >> each of x,y,z.
>
> $re7 = /^ <!before <$re1> | <$re2> | <$re3> > /;
>
> [...lots of discussion about whether the above works or not...]
I think it may be even simpler than the above, no lookaheads required:
$re7 = / <!$re1> & <!$re2> & <!$re3> /;
Pm