Hello Augeas experts,

at the end, I have pasted a broken Augeas module definition, which demonstrates 
what I want to achieve. Currently, the below pasted module, instead of adding 
subsequent members to the same group, always creates a new tree node with one 
child node. However, given a source text, I want to look for repetitions and 
bundle them together in a subtree. The problem is, that part of the repeated 
pattern is variable. Can I somehow memorize a matched string in Augeas and use 
it for pattern matching?

Thank you for your time,
Xavier.


module Test_for_consecutive_matches =

let source =
"create group1
create group2
addto group1 memberA
addto group1 memberB
addto group2 memberX
addto group2 memberY
addto group2 memberZ
"

let create = [ key "create" . Sep.space . store Rx.word . Util.eol ]

let addto = [ key "addto" . Sep.space . store Rx.word . Sep.space .
              counter "members" . [ seq "members" . store Rx.word ] .
              Util.eol
            ]

let lns = ( create | addto )*

test lns get source =
{ "create" = "group1" }
{ "create" = "group2" }
{ "addto" = "group1"
  { "1" = "memberA" }
  { "2" = "memberB" }
}
{ "addto" = "group2"
  { "1" = "memberX" }
  { "2" = "memberY" }
  { "3" = "memberZ" }
}



****
Karlsruher Institute of Technology (KIT)
Steinbuch Centre for Computing (SCC)

B. Sc. Xavier Mol
GridKa Storage Administrator and Support Manager

Hermann-von-Helmholtz-Platz 1
Geb. 449
76344 Eggenstein-Leopoldshafen
Phone: +49 721 608 23041
Email: [email protected]
www.kit.edu
KIT - University of the State of Baden-Württemberg and National Large-scale 
Research Center of the Helmholtz Association
"Since 2010, the KIT has been certified as a family-friendly university."
****

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
augeas-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/augeas-devel

Reply via email to