fork(1) download
  1. #include <iostream>
  2. #include <regex>
  3. using namespace std;
  4.  
  5. int main() {
  6. regex r(R"(.*\[a\\bc\].*)");
  7. for (auto str : {"111abc222", "333[abc]444", "555[a\\bc]666"}) {
  8. cout << "'" << str << "' -> "
  9. << (regex_match(str, r) ? "" : "NOT ")
  10. << "MATCHED" << endl;
  11. }
  12. return 0;
  13. }
Success #stdin #stdout 0.01s 5440KB
stdin
Standard input is empty
stdout
'111abc222' -> NOT MATCHED
'333[abc]444' -> NOT MATCHED
'555[a\bc]666' -> MATCHED