fork(3) download
  1. #include <iostream>
  2. using namespace std;
  3. #include <regex>
  4.  
  5. int main() {
  6. const std::regex pattern( R"((>|\")<!\\\[LOG\\\[)" );
  7. std::string String = "<!\\[LOG\\[somestringhere\\]LOG\\]!><time=\"12:34:30.0+120\" date=\"9-14-2015\" component=\"mycomponenet\" context=\"\" type=\"1\" thread=\"0\" file=\"mxyfile.cpp\"><!\\[LOG\\[somestringhere\\]LOG\\]!><time=\"12:34:30.0+120\" date=\"9-14-2015\" component=\"mycomponenet\" context=\"\" type=\"1\" thread=\"0\" file=\"mxyfile.cpp\">";
  8. std::string replace = "$1\n<![LOG[";
  9. std::string newtext = std::regex_replace( String, pattern, replace );
  10. std::cout << newtext << std::endl;
  11. return 0;
  12. }
Success #stdin #stdout 0s 3548KB
stdin
Standard input is empty
stdout
<!\[LOG\[somestringhere\]LOG\]!><time="12:34:30.0+120" date="9-14-2015" component="mycomponenet" context="" type="1" thread="0" file="mxyfile.cpp">
<![LOG[somestringhere\]LOG\]!><time="12:34:30.0+120" date="9-14-2015" component="mycomponenet" context="" type="1" thread="0" file="mxyfile.cpp">