Help! Where is the bracket error? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Help! Where is the bracket error?

I have the code: #include <iostream> #include <regex> using namespace std; int main() { string var; getline(cin,var); const regex pattern ("^[a-z_A-Z]\\w*

quot;); if(regex_match(var,pattern)) cout<<"Yes"; else cout<<"No"; } However, the program returns a regex_error on compilation. To further find the error's cause, I added a catch call, and found it to be a error_brack. But I am unable to find the mismatched bracket pair. Please help me find the reason for the error...

29th Nov 2017, 5:58 AM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
1 Answer
+ 4
Thank You everyone. When the code failed on Sololearn's Code Playground, I ran it on CppDroid. But even there the code failed. Perhaps its because it uses gcc4.8. Ill run it on Code::Blocks...
29th Nov 2017, 9:11 AM
Kinshuk Vasisht
Kinshuk Vasisht - avatar