fork(5) download
  1. #include <iostream>
  2. #include <regex>
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. string test{ "Hier drin wird gesucht und auch ersetzt." };
  10. string a{ "drin" };
  11. string b{ "auch" };
  12. regex r( R"(\b)" + a + R"(\b(.*?)\b)" + b + R"(\b)");
  13. string result = regex_replace(test, r, "$1");
  14. cout << result << endl;
  15.  
  16. return 0;
  17. }
Success #stdin #stdout 0s 3560KB
stdin
Standard input is empty
stdout
Hier  wird gesucht und  ersetzt.