|
Boost : |
From: Eric Niebler (eric_at_[hidden])
Date: 2006-11-03 12:23:44
John Maddock wrote:
> Luc LA. ALQUIER wrote:
>> match_extra Instructs the matching engine to retain all available
>> HYPERLINK "http://www.boost.org/libs/regex/doc/captures.html"capture
>> information; if a capturing group is repeated then information about
>> every repeat is available via HYPERLINK
>> "http://www.boost.org/libs/regex/doc/match_results.html#m17"match_results::captures()
>> or HYPERLINK
>> "http://www.boost.org/libs/regex/doc/sub_match.html#m8"sub_match_captures().
>>
>>
>> This feature was for me THE great feature that can provide a great
>> way to link related information together.
>>
>> But the behavior using this flag with search (algorithm) was not the
>> one expected (for me).
>>
<snip>
>
> Nod: understood. However there are a couple of problems here:
>
> 1) The underlying engine has no knowledge of whether one capturing group is
> embedded "inside" another. This pretty much rules out tree-like structures
> without a major rewrite.
You might look into xpressive, a new regex engine that will be part of
Boost 1.34. With xpressive, you can build grammars out of regexes, and
the results of matching such a grammar is a tree of results.
You can read about xpressive's regex grammars and nested results here:
http://tinyurl.com/9f6x3
The code lives here:
http://boost-consulting.com/vault/index.php?directory=Strings%20-%20Text%20Processing
-- Eric Niebler Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk