fork(2) download
  1. #include <iostream>
  2. #include <regex>
  3. using namespace std;
  4.  
  5. int main() {
  6. std::regex rex1(R"((.+?)([^\\.]+\.[^\\.]+)$)");
  7. std::smatch m;
  8. std::string str = "c:\\Python27\\REGEX\\test_regex.py";
  9. if (regex_search(str, m, rex1)) {
  10. std::cout << "Path: " << m[1] << std::endl;
  11. std::cout << "File name: " << m[2] << std::endl;
  12. }
  13.  
  14. return 0;
  15. }
Success #stdin #stdout 0s 3540KB
stdin
Standard input is empty
stdout
Path: c:\Python27\REGEX\
File name: test_regex.py