Notepad++ is a free power user’s text editor for Windows. It is more or less standard to have if you do any sort of code hacking, be it for CSS, PHP or whatever you need a superior text editor for.
One function that everybody needs to know how to use in a text editor is replace. There will be times when you will want to replace text with the addition of a new line (i.e. "replace X with Y and press enter once").
The way to do this in Notepad++ is easy once you know how it’s done.
Let’s say you have this:

..and you wanted to search-and-replace so that each instance of "This is a test." was on a separate line.
Press CTRL+H for the replace function, and fill out as follows:

Next to Find what, I enter a period because that’s where I want the line break to occur. Next to Replace with I enter that same period (because I want it to stay there and not be removed), followed by \r.
On the bottom, I tick the option for Extended (\n, \r, \t, \0, \x…) so the \r will work.
After that, I click Replace All in the same window.
What happens is this:

NPP tells me how many occurrences were replaced, and then my final result is this:

NPP found the period, and for each replaced it with a period followed by a new line.
Important things to know
The \r switch will work anywhere, so if you wanted NPP to add a new line before the replacement text, just place \r the beginning instead of the end.
You can in fact search for things like single blank spaces and replace them with new lines. For example, if you open up an old text file that has a bunch of improperly formatted text flying all over the place, you can search for two spaces, replace with \r, and on every instance of a double-space NPP will replace with a new line.
Knowing how to do this will save you lots of time if you use NPP frequently.

Like what you read?
If so, please join over 28,000 people who receive our exclusive weekly newsletter and computer tips, and get FREE COPIES of 5 eBooks we created, as our gift to you for subscribing. Just enter your name and email below:



Is there a reason why you say “/r” in two in places in the article when in the picture example and the “Extended options” step you have “r” entered?
Goof on my part. I’ll fix after I write this reply.