Peter Boot wrote:
Is there functionality included in boost::xpressive::regex_search(...) that would allow you to know which of an alternated group of expressions e.g. "aaa|bbb|ccc" matched a substring in the input ?
Just as with Perl and with Boost.Regex, you could create backreferences
and check to see which participated in the match:
"(aaa)|(bbb)|(ccc)"
Then pass a match_results<> object to regex_search and check
"what[N].matched" for N=1,2,3 (assuming your match_results<> object was
named "what").
If the alternates are all string literals, then you can use an xpressive
symbol table instead and discover which alternate matched more
efficiently. For that you'd initialize a std::map with your alternates ...
std::map