fork(4) download
  1. #include <regex>
  2. #include <string>
  3. #include <iostream>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. std::string s("\r\n { \r\nSome text here");
  9. std::string s2("\r\n { \r\n//Some text here\nSome more test");
  10. regex r1(R"(^\s*\{\s*\n)");
  11. regex r2(R"(^\s*\{\s*//.*\n)");
  12. std::string newtext = std::regex_replace( s, r1, "" );
  13. std::cout << newtext << std::endl;
  14. std::string newtext2 = std::regex_replace( s2, r2, "" );
  15. std::cout << newtext2 << std::endl;
  16.  
  17. }
Success #stdin #stdout 0s 3552KB
stdin
Standard input is empty
stdout
Some text here
Some more test