fork download
  1. #include <iostream>
  2. #include <regex>
  3. using namespace std;
  4.  
  5. int main() {
  6. std::string s = "abc 123 hbcv";
  7. std::regex reg(R"(\D+)");
  8. std::cout<<std::regex_replace(s, reg, "");
  9. return 0;
  10. }
Success #stdin #stdout 0s 15344KB
stdin
Standard input is empty
stdout
123