Problem with whitespace in regular expression
Posted: Mon Aug 17, 2009 7:25 am
I have the following simple code:
std::string str = "This is a simple test"
std::tr1::cmatch res;
std::tr1::regex rx("a(\\s+)sim");
std::tr1::regex_search(str.c_str(), res, rx);
which compiles correctly but fails at execution time with the following message:
Debug Assertion Failed!
Program test.exe
File f:\dd\vctools\crt_bld\self_x86\crt\src\dbgheap.c line 1511
Expression: _CrtIsValidHeappointer(pUserData)
Every other expression that does not contain \\s+ executes properly, but this one does not. I have tried the same with boost and it has teh same problem.
Any idea what could be wrong?
std::string str = "This is a simple test"
std::tr1::cmatch res;
std::tr1::regex rx("a(\\s+)sim");
std::tr1::regex_search(str.c_str(), res, rx);
which compiles correctly but fails at execution time with the following message:
Debug Assertion Failed!
Program test.exe
File f:\dd\vctools\crt_bld\self_x86\crt\src\dbgheap.c line 1511
Expression: _CrtIsValidHeappointer(pUserData)
Every other expression that does not contain \\s+ executes properly, but this one does not. I have tried the same with boost and it has teh same problem.
Any idea what could be wrong?