this is not a duplicate question(How to delete “\r\n”, but only in certain sections of my text?) I'm looking for a more flexible solution;
this is not matter of a XML file; just for this sample it happened to be in xml form; it's a general question about how to implement the idea;
this is a sample of a very large text:
<nx1>home</nx1>
<nx2>living</nx2>
<out>text one
text continues
and at last!</out>
<m2>dog</m2>
How can I search for the <out>...</out>
block and then within that block replace all \r\n
characters with empty string(remove line breaks) and after that put the newly created text in place of the old <out>...</out>
block?
so the result for this sample would be:
<nx1>home</nx1>
<nx2>living</nx2>
<out>text one text continues and at last!</out>
<m2>dog</m2>
How can I implement that in python using regex?