fork(5) 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("Blah blah blah 2015/11/03 20:25:50 blah blah blah");
  12. std::regex pattern("([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})");
  13. std::smatch result;
  14.  
  15. if (regex_search(data, result, pattern)) {
  16. std::cout << result[0] << std::endl;
  17. }
  18. }
Success #stdin #stdout 0s 3540KB
stdin
Standard input is empty
stdout
2015/11/03 20:25:50