[augeas-devel] Getting pattern and checking values against regexp

Raphaël Pinson raphink at gmail.com
Thu Jul 24 18:41:28 UTC 2008


On Thu, Jul 24, 2008 at 5:53 PM, David Lutterkort <dlutter at redhat.com>
wrote:

> On Thu, 2008-07-24 at 09:23 +0200, Raphaël Pinson wrote:
> > It might be useful for developers using the Augeas API to access the
> > pattern that Augeas is considering for values. For example, if a dev
> > created a graphical interface using Augeas, they might want to check
> > the values provided by users against the regexp describing these
> > values. Such a function could have a syntax like 'pattern(path)'
> >
> >  pattern("/files/etc/logrotate.d/apache2/rule/file")
> > => /[^,# \n\t{}]+/
>
> This would only be possible if that query is based on the current tree,
> since the pattern for a value can change depending on whether other
> nodes in the tree are present or not. For example,
>
>        let lns =  ([ key /u/ ] . [ key /b/ . store /[0-9]+/ ])
>                   | ([ key /v/ ] . [ key /b/ . store /[a-z]+/ ])
>


Yes, I understand that problem, and I meant to use it against the current
tree. It would not be to check in general what a field could contain, but in
the context of the tree. Maybe my example was a bit vague and I could have
written

pattern("/files/etc/logrotate.d/apache2/rule[2]/file[3]")
=> /[^,# \n\t{}]+/


Is that what you mean about using the current tree ?


Raphael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20080724/f638b9d8/attachment.htm>


More information about the augeas-devel mailing list