#include <iostream>
#include <string>
#include <regex>
int main() {
std::string s = "abc 9836 xy%^(s 21 * 9 ppp r100s";
std::regex rgx("\\d+");
for (std::sregex_iterator i = std::sregex_iterator(s.begin(), s.end(), rgx);
i != std::sregex_iterator();
++i) {
std::cout << i->str() << "\n";
}
}
/*
run:
9836
21
9
100
*/