fork download
  1. #include <iostream>
  2. #include <regex>
  3. using namespace std;
  4.  
  5. int main() {
  6. regex re("(^|[^_[:alnum:]])(the|a)($|[^_[:alnum:]])", regex_constants::icase);
  7.  
  8. if(regex_search("the test", re))
  9. cout << "#1 matches!\n";
  10.  
  11. if(regex_search("A TEST", re))
  12. cout << "#2 matches!\n";
  13.  
  14. if(regex_search("wat?", re))
  15. cout << "#3 matches!\n";
  16. }
Success #stdin #stdout 0s 3316KB
stdin
Standard input is empty
stdout
#1 matches!
#2 matches!