Breaking the line in between the code in Notepad++

3

I have a file with line(s) that look like this:

<url><loc>URL</loc><lastmod>Date</lastmod><changefreq>Time</changefreq>

I'm editing the file in Notepad++, and I want to be able to break the HTML at its structural boundaries; e.g., I want the result to be:

<url>
<loc>URL</loc>
<lastmod>Date</lastmod>
<changefreq>Time</changefreq>

How can I do this in Notepad++?

Kin

Posted 2015-06-24T02:52:57.060

Reputation: 31

Answers

1

Use search and replace, and make sure Extended Search Mode is enabled, then replace >< with >\n< which will match (and add) exactly 3 new lines

teikjoon

Posted 2015-06-24T02:52:57.060

Reputation: 178

-2

Go to View -> Word Wrap. Make sure that is checked.

Change the search mode to Extended then use \n.

Jatin

Posted 2015-06-24T02:52:57.060

Reputation: 379

And then do what?  Finding > and replacing with >\n is too broad; it produces seven lines, rather than the desired four. – G-Man Says 'Reinstate Monica' – 2015-06-24T03:09:32.343

Treat it like XML. Use this plugin for notepad Or maybe there's a standalone XML formatter out there. If you're running php already, the Dom parser will format it correctly for you.

– rastaBob – 2015-06-24T04:59:32.663

Please comment on downvotes so that it can be improved :) – Jatin – 2015-06-24T20:44:52.753