Forum: Cfengine Help
Subject: Re: regex help
Author: sauer
Link to topic: https://cfengine.com/forum/read.php?3,21705,21762#msg-21762
neilhwatson Wrote:
-------------------------------------------------------
> I removed :? from the expression but still no
> matches.
Sorry - I wasn't paying attention to the end of the regex, since it scrolled
off the edge of my screen. There's another zero-width expression (a negative
lookahead) at the end, and it doesn't follow the "you still need a
positive-width expression to match the space the zero-width look-around also
matched" rule. :)
You have
(:?\S+\s+){4}\S+(?<!00 3 1 \*
\*)\s+/usr/scripts/util/distributed-multipath-ck.sh\s*(?!2>&1 > /dev/null)
right?
The easiest thing to do there would be to just put a .* at the very end after
the lookahead. The thing you have matches with pcregrep because the expression
isn't anchored, but cfengine has an implicit ^ at the beginning and $ at the
end. So, the anchoring is probably what's screwing you. When you test an
anchored regexp outside of cfengine, remember to stick the ^ and $ on either
end. :)
Oh, and don't forget to escape that period in the script path. ;)
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine