fork(14) download
  1. # include <iostream>
  2. #include <regex>
  3.  
  4. int main ()
  5. {
  6. const char * numbers = "500 42 399 4711";
  7. std::regex expr("[0-9]+");
  8. std::match_results<const char *> matches;
  9. if (std::regex_search
  10. (numbers
  11. , matches
  12. , expr
  13. , std::regex_constants::match_continuous))
  14. {
  15. printf ("match: %s", matches [0].str ().c_str ());
  16. }
  17. else
  18. {
  19. puts("No match.");
  20. }
  21. }
  22.  
Success #stdin #stdout 0s 3360KB
stdin
Standard input is empty
stdout
match: 500