help-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: HashCommentLinesMatching


From: Andrew Stribblehill
Subject: Re: HashCommentLinesMatching
Date: Mon, 31 Mar 2003 12:15:20 +0100
User-agent: Mutt/1.5.4i

Quoting Mark Burgess <address@hidden> (2003-03-31 11:40:17 BST):
> On 31 Mar, Akop Pogosian wrote:
> > On Fri, Mar 28, 2003 at 11:05:34PM +0100, address@hidden wrote:
> >> 
> >> Can't you just negate the regular expression?
> > 
> > Oh, there is a way to do that? How?
> 
> See POSIX regular expressions. The ^ symbol negates...but it depends
> on what you're after. See documentation, or
> 
> http://www.iu.hio.no/~mark/unix/unix.html#SEC29

Yeah, that negates character classes. Does the regex library we use
support negative look-{ahead,behind} assertions a-la Perl?:

(?<=foo)d # Matches 'd' provided it's preceeded by 'foo'
(?<!foo)d # Any d without 'foo' immediately before it
rhu(?=baa) # Matches 'rhu' if it has 'baa' after it
rhu(?!baa) # rhu without 'baa' after it

The two negative ones here would do the job nicely.

For that matter, if Cfengine doesn't do this, would there be a
problem with switching to libpcre (Perl-compatible regular expression
library)? I know POSIX is a standard but Perl is more well-known and
is basically just a superset of POSIX extended regular
expressions[0].

Footnote:
  0: Proof by assertion!

-- 
FAIR ISLE
SOUTHWEST, 4 OR 5 IN SOUTHEAST AT FIRST, OTHERWISE 6 TO GALE 8,
PERHAPS SEVERE GALE 9 LATER. RAIN. GOOD BECOMING MODERATE OR POOR




reply via email to

[Prev in Thread] Current Thread [Next in Thread]