In "Find and Replace", how do I replace with NOTHING (deleting empty lines)

Hi!

I’d like to remove empty line in LIbreOffice writer.

I search for empty line by putting in “FInd” the regular expression:

^\s*$

But I’d like to delete this detected empty line now.

How can I do it?

I’ve put nothing into the “Replace” field but it leaves the empty line how it was.

The built-in Find & Replace can operate only within a paragraph content. The paragraph mark, which position (only) is represented by $ is external to paragraph content.

As a consequence, what you do with your regular expression is to erase spacers present in the spacer-only paragraph, getting a truly empty paragraph.

Unless you install the AltSearch extension, the only means to do it “out of the shelf” is to display the formatting marks (View>Formatting Marks) to make visible the effective content of your document (including spaces, tabs, new lines, paragraph marks, …). Then you must hunt manually for empty paragraphs and remove them with Backspace or Del.

To show the community your question has been answered, click the ✓ next to the correct answer, and “upvote” by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!

Actually, LibreOffice F&R has two dedicated patterns that may operate on paragraph boundaries themselves. They are ^$ (allows to remove already empty paragraphs), and $ (allows joining all paragraphs together). See this FAQ.