fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <regex>
  4. int main()
  5. {
  6. std::string strr("1.0.0.0029.443");
  7. //const char* strr = "1.0.0.0029.443";
  8. std::regex rgx("([0-9])""([0-9])""([0-9])""([0-9])");
  9. std::smatch match;
  10.  
  11. regex_search(strr, match, rgx);
  12. std::cout<<match.size()<<std::endl;
  13. for(int i = 0; i < 6; i++){
  14. std::cout <<"UJH OH"<< match[i] << std::endl;
  15. }
  16. }
Success #stdin #stdout 0.01s 5292KB
stdin
Standard input is empty
stdout
5
UJH OH0029
UJH OH0
UJH OH0
UJH OH2
UJH OH9
UJH OH