Possible Duplicate:
Is gcc4.7 buggy about regular expressions?
I compile the code below with “g++ test.cpp -std=gnu++0x” .
Compilation is successful but when I run./a.out it gives error like that I do not understand why it happens. My operating system s Mint.
Error:
”
terminate called after throwing an instance of ‘std::regex_error’
what(): regex_error
Aborted (core dumped)
“
Code:
// regex_match example
#include <iostream>
#include <string>
#include <regex>
using namespace std;
int main ()
{
string s ("this subject has a submarine as a subsequence");
regex e("sub[a-z]"); // matches words beginning by "sub"
smatch m;
return 0;
}
The code looks fine. GCC’s implementation of regex is unusable. Don’t waste your time with it.