[augeas-devel] Support for regex captures in key?

Richard Dawe rich.dawe at messagesystems.com
Thu Nov 27 17:42:33 UTC 2014


Hello,

I would like to use they key lens to capture part of a regular expression, to use as the label. Is this possible using a POSIX extended regular expression capture? It does not seem work. E.g.: key /foo(bar)/ -> label of “bar”.

Background: I am writing a lens to parse one of the proprietary configuration formats used by my company’s products. At the moment I am capturing the name of an array using something like:

  key /[A-Za-z0-9_:]+[ \t]+=/

which, for example, results in a key like “uri =“. I would like it be more like “uri”. Ideally I’d like it to be “uri()” to indicate it’s an array.

The reason I’m matching the equals sign is to disambiguate the lens from another lens, to avoid ambiguities during the put operation.

Presumably POSIX ERE captures don’t work because the whole label is needed in order for the put operation to work?

Thanks, best regards, Richard Dawe

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20141127/97c9c8ae/attachment.htm>


More information about the augeas-devel mailing list