fork(1) download
  1. #include <iostream>
  2. #include <vector>
  3. #include <regex>
  4.  
  5. int main() {
  6. const std::regex reg("\\{(.*?)\\}(?![^;])");
  7. std::smatch match;
  8. std::string s = "Username={My_{}user};Password={my_pswd}}123}}}kk};Password={my_pswd}}123}";
  9. std::vector<std::string> results(
  10. std::sregex_token_iterator(s.begin(), s.end(), reg, 1),
  11. std::sregex_token_iterator());
  12. for (auto result : results)
  13. {
  14. std::cout << result << std::endl;
  15. }
  16.  
  17. return 0;
  18. }
Success #stdin #stdout 0s 4376KB
stdin
Standard input is empty
stdout
My_{}user my_pswd}}123}}}kk my_pswd}}123