Multiline string replace with pretty indentation
问题 I want to do multi-line string replacements in some template files, but retain a pretty indentation. Here's an example of the template: <TAG1> <TAG2> %REPLACETHIS% </TAG2> </TAG1> Now, when I simply replace the string %REPLACETHIS% with a string like <REPLACEDSTRINGTAG1> replacedstringtext </REPLACEDSTRINGTAG1> it will look something like: <TAG1> <TAG2> <REPLACEDSTRINGTAG1> replacedstringtext </REPLACEDSTRINGTAG1> </TAG2> </TAG1> when it should look like: <TAG1> <TAG2> <REPLACEDSTRINGTAG1>