fork download
  1. #include <iostream>
  2. #include<regex>
  3. using namespace std;
  4.  
  5. int main() {
  6.  
  7. string s ("/home/fypj/build/simple-loops.cc/");
  8. smatch m;
  9. regex e ("(\\.[^.]+)$");
  10. regex_search (s,m,e);
  11.  
  12. cout << m.str() <<endl;
  13. cout << m.str(1) <<endl;
  14. return 0;
  15. }
Success #stdin #stdout 0s 3540KB
stdin
Standard input is empty
stdout
.cc/
.cc/