You can use multiple negative lookbehinds to do what you want. Although I imagine fellow monks will probably have a more elegant solution.
use strict; use warnings; for ( <DATA> ) { my $variable = qr/(?<!mild\s)(?<!moderate\s)active/; print $_ if ( m/$variable/ ); } __DATA__ foo active mild active moderate active active
Outputs
foo active active
In reply to Re: Conditional matching into qr variable
by rnewsham
in thread Conditional matching into qr variable
by ryanUK
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |