[augeas-devel] Support for regex captures in key?
Raphaël Pinson
raphael.pinson at camptocamp.com
Thu Nov 27 18:38:27 UTC 2014
Hi Richard,
You need to delete the parts you're not interested in. In your uri= case,
use:
key /[A-Za-z0-9_:]+/ . del /[ \t]+=/ " ="
Raphael
On Thu, Nov 27, 2014 at 6:42 PM, Richard Dawe <rich.dawe at messagesystems.com>
wrote:
> 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
>
>
> _______________________________________________
> augeas-devel mailing list
> augeas-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/augeas-devel
>
--
Raphaël Pinson
Infrastructure Developer & Training Leader
+33 479 26 57 93
+33 781 90 00 79
Camptocamp France
Savoie Technolac
BP 352
48, avenue du Lac du Bourget
73372 Le Bourget du Lac, Cedex
www.camptocamp.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20141127/77be15c1/attachment.htm>
More information about the augeas-devel
mailing list