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?
Problem with whitespace in regular expression
Moderator: General Moderators
- prometheuzz
- Forum Regular
- Posts: 779
- Joined: Fri Apr 04, 2008 5:51 am
Re: Problem with whitespace in regular expression
The regex looks fine. I suggest posting in a C++/C forum instead (this is a PHP forum).