I simply want to match "{". But don't know why giving this error:
terminate called after throwing an instance of 'std::regex_error' what(): regex_error Aborted (core dumped)
Compilation on Ubuntu with g++ version 4.6.3
g++ -std=c++0x a.c
Program
#include<iostream>
#include<regex>
using namespace std;
main(int argc,char**argv){
if (regex_match("{1}" , std::regex ("[{]"))) {
cout<<"Hello World"<<endl;
}
}
I've also checked the ECMAScript details and this regular expression should match. It also does not match when I use like : std::regex ("\\{"))
What am I wrong?