fork(7) download
  1. #include <regex>
  2. #include <string>
  3. #include <iostream>
  4. #include <time.h>
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. struct tm tm;
  10. time_t t;
  11. string data("1\n2\n3");
  12. std::regex pattern("^\\d+$");
  13. std::smatch result;
  14.  
  15. while (regex_search(data, result, pattern)) {
  16. std::cout << result[0] << std::endl;
  17. data = result.suffix().str();
  18. }
  19. }
Success #stdin #stdout 0s 3548KB
stdin
Standard input is empty
stdout
Standard output is empty