fork(5) download
  1. #include <iostream>
  2. #include <regex>
  3. using namespace std;
  4.  
  5. int main() {
  6. string s = " 'I'd go.' ";
  7. s = std::regex_replace(s, std::regex("((^| )')|('($| ))"), "$1$3(Quotation, )");
  8. cout << s;
  9. return 0;
  10. }
Success #stdin #stdout 0s 4500KB
stdin
Standard input is empty
stdout
 '(Quotation, )I'd go.' (Quotation, )