fork(9) download
  1. #include <iostream>
  2. #include <regex>
  3. using namespace std;
  4.  
  5. int main() {
  6. std::string s = "text here++ text\n+ text text\n+ text\ntext text";
  7. std::regex r("(^|\n)\\++");
  8. std::cout << std::regex_replace(s, r, "$1-") << std::endl;
  9. return 0;
  10. }
Success #stdin #stdout 0s 4408KB
stdin
Standard input is empty
stdout
text here++ text
- text text
- text
text text