fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <regex>
  4.  
  5. int main( )
  6. {
  7. std::regex rgx(":((?!.*:).*$)");
  8. std::smatch match;
  9. std::string input = "concept:personasia:toby_pizur:personasia:teste";
  10.  
  11. if (std::regex_search(input, match, rgx))
  12. {
  13. std::cout << match[1];
  14. }
  15.  
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0s 4536KB
stdin
Standard input is empty
stdout
teste