fork(1) download
  1. #include <regex>
  2. #include <string>
  3. #include <iostream>
  4. using namespace std;
  5.  
  6. int main() {
  7. std::regex expression(R"(am\s+(\d+))");
  8. std::smatch match;
  9. std::string what("I am years old.");
  10. if (regex_search(what, match, expression))
  11. {
  12. cout << match.str(1) << endl;
  13. }
  14. return 0;
  15. }
Success #stdin #stdout 0s 16160KB
stdin
Standard input is empty
stdout
Standard output is empty