[regex] BOOST_REGEX_MATCH_EXTRA not working?

Hi there, pretty new to boost::regex and though I'm just toying around with the documentation and some basic test code. The following code crashes when setting the BOOST_REGEX_MATCH_EXTRA symbol. #include <iostream> #include <boost/regex.hpp> void print_captures( const std::string& regx , const std::string& text ) { boost::regex e( regx ); boost::smatch what; std::cout << "Expression: \"" << regx << "\"\n"; std::cout << "Text: \"" << text << "\"\n"; // crash occurs in the next statement if( boost::regex_match( text, what, e, boost::match_extra )) { unsigned int i,j; std::cout << "**Match found ** \n Sub-Expressions:\n"; for( i = 0; i < what.size(); ++i ) { std::cout << " $" << i << " = \"" << what[i] << "\"\n"; } std::cout << " Captures:\n"; for( i = 0; i < what.size(); ++i ) { std::cout << " $" << i << " = {"; for( j = 0; j < what.captures(i).size(); ++j ) { } } } } int _tmain(int argc, _TCHAR* argv[]) { print_captures( "(.*)bar|(.*)bah", "abcbar" ); return 0; } I'm using MSVC10 express. Am I doing something wrong? Regards, Christian
participants (2)
-
Christian Henning
-
John Maddock