My regular expression with a '}' is throwing exception when I use the microsoft tr1::regex. But the same regex work fine with other regular expression interpreters.
Here is the simplified sample code.
string source = "{james}";
string exp = "{(.*)}";
std::tr1::cmatch res;
std::tr1::regex rx(exp);// Throws Exception here
while(std::tr1::regex_search(source.c_str(), res, rx))
{
std::cout <<" "<< res[1]<<endl<<"....."<<endl;
source = res.suffix().str();
}
The same code works fine here. What am I missing here? I have tried escaping the '{', but that also doesn't work
string source = "\{james\}";
string exp = "\{(.*)\}";
I am using Visual studio 2010.
Thanks Sunil