fork(24) download
  1. #include <regex>
  2. #include <string>
  3. #include <iostream>
  4. using namespace std;
  5.  
  6. int main() {
  7. string user_pattern(":.*");
  8. string s("test:55:last");
  9. regex r("^.*(" + user_pattern + ")");
  10. smatch matches;
  11. if (regex_search(s, matches, r)) {
  12. cout<<matches[1].str();
  13. }
  14. return 0;
  15. }
Success #stdin #stdout 0s 3552KB
stdin
Standard input is empty
stdout
:last