help-cfengine
[Top][All Lists]
Advanced

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

Re: Editfiles, DeleteCommands, POSIX Syntax, etc


From: Brian E. Seppanen
Subject: Re: Editfiles, DeleteCommands, POSIX Syntax, etc
Date: Thu, 10 Apr 2003 07:24:25 -0400 (EDT)

On Thu, 10 Apr 2003, Andrew Stribblehill wrote:

> Quoting Brian E. Seppanen <seppy@chartermi.net> (2003-04-09 08:39:29 BST):
> > Hello:
> > 
> > I'm desperate to use editfiles for some ACL maintanence, and to do so I
> > need to insure that I can clear a couple of lines with the DeleteCommands,
> > unfortunately I cannot, for the life of me, define a regex or pattern that
> > will match, and I'm frankly baffled.  I need to match
> > 
> >     only_from       += 192.168.0.0/24
> > 
> > In all cases I've been careful to escape the + and the .'s   I've had luck 
> > with a BeginGroupIfNoMatch, so I'm pretty sure, I haven't missed escaping 
> > something.
> 
> Cfengine uses regular expressions in a 'tied' manner i.e. the whole
> line must match the regular expression. So, try this:
> 
> DeleteLinesMatching '^only_from +\+= 129\.168\.0\.0/24$'
> 
> The ^ and $ are optional but I like them there to remind me what's
> going on.

How can I express tabs in the expression?  Is there a regex that is clever
enough to handle an unlimited number of IP's?  What I mean by an
unliminited number of IP's is if I have something like 192.168.0.0/24
10.0.0.0/8 172.19.0.0/16 is there a regular expression that could match 
multiple's in a single definition.   


something like

^only_from\+= 
([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/[0-9]{1,2})*$

I hope that makes some sense.

Thanks for the insight.


Brian Seppanen
seppy@chartermi.net
906-228-4226 ext 23





reply via email to

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