If you have another look at perlre you'll see that ?!(mild)) is a look ahead assertion and you need look behind ?<!(mild).

But, at least on my version of perl 5.16 the docs say

"(?<!pattern)" A zero-width negative look-behind assertion. For examp +le "/(?<!bar)foo/" matches any occurrence of "foo" that does not follow "bar". Works +only for fixed-width look-behind.

So you probably need to try a different approach, Try doing your test in 2 phases 1. match lines with active and capture the previous word then 2. skip any line where that word is 'mild' or 'moderate'.

If you show a few example lines of your data then someone here may have a better suggestion.


In reply to Re: Conditional matching into qr variable by RichardK
in thread Conditional matching into qr variable by ryanUK

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.