I have a text file with thousands of XML strings on each line. However, if any XML string exceeds 32767 characters, then the remaining text is moved to next line.
I need to remove such line breaks to ensure each line has a complete XML string.
Sample version of the file content having line break after 55 characters is as follows:
<?xml version="1.0" encoding=""?><Policy></Policy>
<?xml version="1.0" encoding=""?><Policy></Policy>
<?xml version="1.0" encoding=""?><Policy>111111111111<
/Policy>
<?xml version="1.0" encoding=""?><Policy></Policy>
<?xml version="1.0" encoding=""?><Policy>2222222222222
</Policy>
<?xml version="1.0" encoding=""?><Policy><A></A>333333
33333</Policy>
The output is expected to be as follows:
<?xml version="1.0" encoding=""?><Policy></Policy>
<?xml version="1.0" encoding=""?><Policy></Policy>
<?xml version="1.0" encoding=""?><Policy>111111111111</Policy>
<?xml version="1.0" encoding=""?><Policy></Policy>
<?xml version="1.0" encoding=""?><Policy>2222222222222</Policy>
<?xml version="1.0" encoding=""?><Policy><A></A>33333333333</Policy>
Please suggest how this can be done in Notepad++
>Solution :
- Ctrl+H
- Find what:
\R(?!<\?xml) - Replace with:
LEAVE EMPTY - CHECK Match case
- CHECK Wrap around
- CHECK Regular expression
- Replace all
Explanation:
\R # any kind of linebreak
(?!<\?xml) # negative lookahead, make sure we haven't "<?xml" after
Screenshot (before):
Screenshot (after):

