[Top][All Lists]

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

ReplaceRegex? (was Re: editfiles SetScript & RunScript?)

From: Steve Wray
Subject: ReplaceRegex? (was Re: editfiles SetScript & RunScript?)
Date: Fri, 7 May 2004 07:58:39 +1200
User-agent: KMail/1.6.1

On Thursday 06 May 2004 21:21, Alexander Jolk wrote:
> Steve Wray wrote:
> >         RunScriptIfLineMatching "first"
> >         }
> [...]
> > first second third
> > </filecontent>
> Your first line does not match your pattern "first".  It would match
> if you used "first.*".  Remember, cfengine checks whether the
> complete line matches, not just a substring.

ahhhh thanks! I have been having some difficulty interpreting cfengines 
regular expression useage.

Another example is that the spec for cfengine regex's includes back 
references but I see no way to actually apply them; I only see an 
editfiles action which takes a regex and replaces any line matching 
with the *exact* string given and so far I havn't been able to figure 
out how to backreference a capture ie;

ReplaceAll quoted-regex With quoted-string

I see this as having very limited use. Surely something like

ReplaceRegex quoted-regex With quoted-regex

and used like;

ReplaceRegex "^(first) (second) (third)$" With "\3 \2 \1"

Seems like an obviously useful feature to me... is it in there somewhere 
but I'm just not seeing it?

reply via email to

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