Hi Peter,

On 30.05.2014 20:46, Peter Schwenn wrote:
> Dear Perl6istes,
> How does one express in a perl6 match pattern that if a certain
> subpattern is present the match fails.
> I had expected something like:
> $txt ~~ s/... -[ unwanted \s+ pattern ] .../ .../;
>  but its not that.  Can't find it in S05.

The reason it's not that simple is that it's not enough to say what
*shouldn't* match; you also have to specify the pattern that *should*
match, even if it's .*.

Say you want to match two numbers that are separated by a word that's
not 'perl', you'd write

/ \d+ <!before perl> \w+ \d+ /

So, you solve it with a negative look-ahead.


Reply via email to