Reputation: 2440
So I have to do a lot of work with an XML document editing a lot using find and replace, the bad thing is all of the tags are on different lines, some are on one line but most not.
Here is an example of what they look like:
<Data StartTimecode='00:00:24:17' EndTimecode="00:00:29:08" Title='Lots of sample
text?'/>
<Data StartTimecode='00:00:24:17' EndTimecode="00:00:29:08" Title='Lots of sample text
again?'/>
<Data StartTimecode='00:00:24:17' EndTimecode="00:00:29:08" Title='Lots of sample text?'/>
So I need the data tag to be all on one line as when I am using regular expressions to find and replace it is only finding the lines that are on line. I have spent hours trying to figure this out,I have tried replacing all \n with nothing but it doesn't fix it.
Does anyone know how I use a feature in notepad++ to get all lines like this?
<Data StartTimecode='00:00:24:17' EndTimecode="00:00:29:08" Title='Lots of sample text?'/>
<Data StartTimecode='00:00:24:17' EndTimecode="00:00:29:08" Title='Lots of sample text again?'/>
<Data StartTimecode='00:00:24:17' EndTimecode="00:00:29:08" Title='Lots of sample text?'/>
Many thanks to anyone who can help me figure this out, I have tried a lot in Notepad++ but I can't accomplish this without help.
Upvotes: 0
Views: 3891
Reputation: 1319
On my first pass, I did a replace all using the extended search mode.
I replaced \r\n
with a space character. This effectively creates a file that is one line in height.
Afterwards, I did another replace all for /> <
(notice the space between the tags) with />\r\n<
. This will break up the single line of XML code into multiple lines, between the end tag of one line and the opening tag of the next lnk
I haven't looked into the possibility of using the regular expression search mode.
Upvotes: 1