[regex] access to subexpressions

Hi is there a way to access the subexpressions in a tree-like manner? For instance, suppose I have this regular expression ((").*(\2)) that matches against this string test"ooo"foo the results are prefix: test what[0]: "ooo" what[1]: "ooo" length: 5 what[2]: " length: 1 what[3]: " length: 1 suffix: foo I need to format the matched part with tags, say, like this <matched> <sub>"</sub> ooo <sub>"</sub> </matched> but in order to do this, when I inspect what[1], I'd need to know that it has two subexpressions, while I cannot know that what[2] and what[3] are indeed subexpressions of what[1]... That is to say, subexpressions are flattened. thanks in advance Lorenzo -- Lorenzo Bettini, PhD in Computer Science, DSI, Univ. di Firenze ICQ# lbetto, 16080134 (GNU/Linux User # 158233) HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com http://www.gnu.org/software/src-highlite http://www.gnu.org/software/gengetopt http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net
participants (1)
-
Lorenzo Bettini