help-cfengine
[Top][All Lists]
Advanced

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

Re: How to use regex in editfiles?


From: Josef Wolf
Subject: Re: How to use regex in editfiles?
Date: Tue, 31 Aug 2004 22:05:19 +0200
User-agent: Mutt/1.4.1i

On Sun, Aug 29, 2004 at 12:47:50AM -0500, Frank Smith wrote:
> --On Saturday, August 28, 2004 11:29:48 +0200 Josef Wolf <jw@raven.inka.de> 
> wrote:

> >     AppendIfNoLineMatching "cfengine[:blank:]+5308/tcp"
> Try this instead:
> AppendIfNoLineMatching "cfengine[[:blank:]]5308/tcp.*"

Thanks for the hint.  The following line seems to do what I want:

  AppendIfNoLineMatching "cfengine[[:blank:]]+5308/tcp.*"

> which should also match lines with trailing spaces and/or comments.

Ough!  This is a pretty non-standard behavior.  Why is this needed?  As
long as no '$' is used at the end, the '.*' should not make any difference.
I don't know any regex implementation that makes such a requirement.
If this behavior is by intention, then it clearly needs to be properly
documented, since this is a big deviation from the standard (which is to
automatically ignore leading/trailing contents unless '^' or '$' is used).

BTW: The documentation don't say that the sqare brackets need to be
     doubled as shown above.  Maybe the documentation should be
     extended accordingly?

-- 
Please visit and sign and http://www.ffii.org
-- Josef Wolf -- jw@raven.inka.de --




reply via email to

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