Breakup a Super Long Line

These days lots of other languages are used to generate HTML; VB, c#, PHP, Perl, etc. They can make some pretty awful stuff. One example, is a ~1.5 meg single line of HTML. This is really unusual and I wanted to determine if it was messing up IE6/7. How do you break this line with a Find/Replace in Notepad++?

The textboxes in the Find/Replace dialog are single lines. Carriage returns are chopped off when you Paste.

Turns out it’s pretty easy if you turn on RegEx. Add your line of text in Find and add the similar line with a ‘\n’ at the end to the Replace box. Check ‘Regular Expressions’ and click Replace to watch it run once. Do “Replace All”. Voila, lots and lots of smaller lines.

Leave a Reply

You must be logged in to post a comment.