fork(1) download
  1. #include <iostream>
  2. #include <regex>
  3.  
  4. int main() {
  5. std::string s = "{\"|1|\":\"A\",\"|2|\":\"B\",\"|37|\":\"4234235\",\"|4|\":\"C\"}";
  6. std::cout << s <<"\n";
  7. std::regex regex(R"(\|37\|":"(\d+))");
  8. std::smatch m;
  9. regex_search(s, m, regex);
  10. std::cout << "match: " << m.str(1) << std::endl;
  11. return 0;
  12. }
Success #stdin #stdout 0s 4956KB
stdin
Standard input is empty
stdout
{"|1|":"A","|2|":"B","|37|":"4234235","|4|":"C"}
match: 4234235