Simple regular expression to replace blank lines in Notepad Plus Plus


To find blank lines in a document and replace them with html code, you can use Notepad Plus Plus and regular expressions.

Open the Find and Replace dialogue, check the Regular Expression option and in the “Find” textbox write: ^\h*\R

Then in the “Replace” textbox write: <p>&nbsp;</p>, to add a full paragraph, or <br> to replace blank lines with just a line break.

Note that Notepad Plus Plus will put your code at the beginning of the next, non-empty line. To have it on its own line, in the replace option just add a new-line option: <p>&nbsp;</p>\n

Enjoy!