fork(1) download
  1. #include <iostream>
  2. #include <string>
  3. #include <regex>
  4. using namespace std;
  5.  
  6. int main() {
  7. string userInput = "=";
  8. regex infix(R"([()\d+/*-]+)");
  9. if(regex_match(userInput,infix)){
  10. cout<<"Valid expression!\n";
  11. } else {
  12. cout<<"Error: Not a valid infix expression!\n";
  13. }
  14. return 0;
  15. }
Success #stdin #stdout 0s 15336KB
stdin
=
stdout
Error: Not a valid infix expression!