fork(1) download
  1. #include <regex>
  2. #include <string>
  3. #include <iostream>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. string regx = R"((\d+\.\d+\.)\d+\.\d+)";
  9. string input = "192.168.1.1";
  10. smatch matches;
  11. if (regex_search(input, matches, regex(regx)))
  12. {
  13. cout<<matches[1]<<"."<<endl;
  14. }
  15. return 0;
  16. }
Success #stdin #stdout 0s 3552KB
stdin
Standard input is empty
stdout
192.168..