Forum: Cfengine Help Subject: Re: regex help Author: sauer Link to topic: https://cfengine.com/forum/read.php?3,21705,21716#msg-21716
neilhwatson Wrote: ------------------------------------------------------- > I'm very confused now. PCREgrep matches both > lines. You're right. I was testing with the \s inside the negative lookbehind, which needs to be there in the provided pattern. I think this is because the \s+ in the repeated match at the beginning will have matched all of the spaces, so the \s* preceeding the command has nothing to match. When you then stick the negative lookbehind in there, it's thus being searched for right up against the path to the command. I thought that making the \s+ into a \s+? so that it becomes minimally greedy should also resolve that, but it doesn't appear to be the case. So, what you have to do (if you want that) is stop eating the fifth whitespace grouping, (:?\S+\s+){4}\S+(?<!00 3 1 \* \*)\s+/usr/scripts.* instead, as that leaves the whitespace right before the path to the command alone, and you shift your negative lookbehind back to preceeding the space instead of preceeding the command. _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine