fork(25) download
  1. #include <iostream>
  2. #include <regex>
  3. #include <string>
  4. using namespace std;
  5.  
  6. int main() {
  7. std::regex r("^\\d+$");
  8. std::string s = "1\n2\n3";
  9. for(std::sregex_iterator i = std::sregex_iterator(s.begin(), s.end(), r);
  10. i != std::sregex_iterator();
  11. ++i)
  12. {
  13. std::smatch m = *i;
  14. std::cout << "Match value: " << m.str() << " at Position " << m.position() << '\n';
  15. }
  16. return 0;
  17. }
Success #stdin #stdout 0s 3552KB
stdin
Standard input is empty
stdout
Standard output is empty