fork(1) download
  1. #include <iostream>
  2. #include <regex>
  3. #include <string>
  4.  
  5.  
  6. int main() {
  7. std::string str = "Sebastian_Mix[228]: Привет. Я только что крякнул одну прогу";
  8. std::regex Reg(R"(^(.+)\[(\d+)\]: (.+)$)");
  9. std::smatch results;
  10. if(std::regex_match(str, results, Reg)){
  11. std::cout << results[1].str().c_str() << ": " << results[3].str().c_str();
  12. }
  13. else
  14. std::cout << "Совпадений не найдено";
  15. return 0;
  16. }
Success #stdin #stdout 0s 15336KB
stdin
Standard input is empty
stdout
Sebastian_Mix: Привет. Я только что крякнул одну прогу