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: Wed, 1 Sep 2004 22:15:59 +0200
User-agent: Mutt/1.4.1i

On Wed, Sep 01, 2004 at 04:26:54AM +0200, Mark.Burgess@iu.hio.no wrote:
> On 31 Aug, Wil Cooley wrote:

> > What I don't understand is why the .* are necessary--why does the regex
> > have to match the whole line instead of a substring?  They aren't for
> > other regex implementations.  I guess I could see a safety issue with
> > it...
> This is documented, though nothing is ever documented clearly enough.

Hmmm, I've read through all available documentation but can't find where
this is documented.  Can you give me a hint, please?

> Regular expression implementations do not specify how they are to be used.

Can you give an example for a tool that uses regex in such a way?  What are
the '^' and '$' symbols good for if you require to match the whole line
anyway?  BTW: '^' and '$' _are_ described in the cfengine documentation.

> Frank is right that, for historical reasons, the available functions,
> the names and the behaviours are a bit inconsistent.

No, they are not.  The "Containing" functions all use strings while
the "matching" functions all use regex.  I don't see any inconsistency
here.

> Unfortunately, once done it is
> hard to change to a better idea without breaking something for someone.

Breaking _what_?  This "feature" is not documented.  And no other tool I
know of uses this "feature".

> There are certainly no "safety issues" with regular expressions. The usage
> is designed to make their application as safe as possible, assuming that
> you always check that they match what you think they do. Regular
> expressions are supposed to be standard things, but they are very very
> far from being standard.

They are very far from being standard in respect to the special symbols
supported by the different implementations.  But all implementations seem
to agree on how to handle surrounding content when '^' and '$' are not used.

-- 
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]