fork(1) download
  1. #include <iostream>
  2. #include <regex>
  3. #include <string>
  4. using namespace std;
  5.  
  6. int main() {
  7. string foo("lorem ipsum");
  8. match_results<string::reverse_iterator> sm;
  9.  
  10. if(regex_match(foo.rbegin(), foo.rend(), sm, regex("(\\w+)\\s+(\\w+)"))){
  11. cout << sm[1] << ' ' << sm[2] << endl;
  12. }else{
  13. cout << "bad\n";
  14. }
  15.  
  16. return 0;
  17. }
Success #stdin #stdout 0s 3540KB
stdin
Standard input is empty
stdout
muspi merol