Possible Duplicate:
C++0x regex in GCC
I was trying to transform a file under c++ using regex, some regex_error keeps on occuring, here is the code:
std::ifstream inf(in);
std::ofstream outf(out);
try{
std::regex line_regex("[[:alnum:]]");
std::string line;
while(std::getline(inf,line))
{
if(std::regex_match(line,line_regex))
outf<<line<<std::endl;
}
the error message is:
terminate called after throwing an instance of 'std::regex_error'
what(): regex_error
by the way, I'm using gcc 4.7.2 on linux x64.
std::regexon 4.6.2 and couldn't get it to work either. Ended up wrapping PCRE instead. I think the Perl regex syntax is the best and most expressive and PCRE is an extremely stable time-honored library.