[augeas-devel] [PATCH] Add regexpi to XPath syntax for case insensitive regexps

Raphaël Pinson raphael.pinson at camptocamp.com
Thu May 31 21:27:30 UTC 2012


On Thu, May 31, 2012 at 11:14 PM, David Lutterkort <lutter at redhat.com>wrote:

> On Thu, 2012-05-31 at 10:20 +0200, Raphaël Pinson wrote:
> > Quite a few configuration files support case insensitive keys. This is
> the
> > case of the (newly committed) postgresql.conf.
> >
> > With this new regexpi function, we can do things like this:
> >
> > augtool> match /files/etc/postgresql/8.4/main/postgresql.conf/*[label()
> =~
> > regexp('default_text_search_config')]
> >   (no matches)
> > augtool> match /files/etc/postgresql/8.4/main/postgresql.conf/*[label()
> =~
> > regexpi('default_text_search_config')]
> >
> /files/etc/postgresql/8.4/main/postgresql.conf/DEFAULT_teXt_search_config =
> > 'pg_catalog.english'
>
> I wonder if we shouldn't just make path expressions match case
> insensitive, so that the path expression /foo/bar also matches
> { "Foo" { "BaR" } } ... are there any examples where case matters and we
> would get unwanted matches ?
>
>

Yes, I wanted to do that too. I had a look at pathx_parse, but I couldn't
figure out how to make this work.

Eventually, I think both would be useful. A case-insensitive evaluation of
paths would allow to use match/get/set/setm/clear/clearm/rm to manage nodes
that can be case-insensitive, but regexpi would still be useful to evaluate
values that are case-insensitive.

For the case-insensitive evaluation of paths, I was thinking that maybe
this could be set somewhere in /augeas, like /augeas/nocase = [01].


Raphaël
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20120531/7deab321/attachment.htm>


More information about the augeas-devel mailing list