fork(5) download
  1. #include <regex>
  2. #include <iostream>
  3.  
  4. int main()
  5. {
  6. const std::string s = "<abc>{{Test}}</abc><def>{{Again}}</def>";
  7. std::regex rgx(R"(\{\{(\w+)\}\})");
  8. std::smatch match;
  9. std::sregex_iterator next(s.begin(), s.end(), rgx);
  10. std::sregex_iterator end;
  11. while (next != end) {
  12. std::smatch match = *next;
  13. std::cout << match.str(1) << std::endl;
  14. next++;
  15. }
  16. return 0;
  17. }
Success #stdin #stdout 0s 4344KB
stdin
Standard input is empty
stdout
Test
Again