1

This simple example using Boost xpressive (latest version) throws the error: Access violation reading location 0x000000. The error occurs on regex_match. This has to be something simple but I've looked at it until I am crazy.

Why does this not work?

using namespace boost::xpressive;

std::string hello( "Apple Orange_" );

const boost::xpressive::sregex rex = boost::xpressive::sregex::compile("(\\w+)\\s(\\w+)_"); 

boost::xpressive::smatch what;

if( regex_match( hello, what, rex ) )
{
  std::string s1 = what[0]; // whole match
  std::string s2 = what[1]; // first capture
}
Ashley Pieterse
  • 85
  • 1
  • 1
  • 10
jedi22
  • 11
  • 2
  • Not a Boost expert, but given that the code you presented is almost a cut-and-paste from the Boost documentation, a bug in Boost maybe? I'd swap out Boost regex for another regex library to confirm. – Rodyland Aug 23 '10 at 06:04
  • I have tried your example with VS 2008 and boost 1.44.0 and it works fine. Which compiler are you using? – J. Calleja Aug 24 '10 at 21:53

0 Answers0