#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
_______________________________________________
Boost-users mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Did you compile the regex library with BOOST_REGEX_MATCH_EXTRA set? If not
the library is binary incompatible with your code.
HTH, John.
On 10/28/10, John Maddock <boost...@virgin.net> wrote:
>> I'm using MSVC10 express. Am I doing something wrong?
>
> Did you compile the regex library with BOOST_REGEX_MATCH_EXTRA set? If not
> the library is binary incompatible with your code.
No, I did not do that. Good to know!
Thanks,
Christian