Ask Your Question
0

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

asked 2019-09-06 09:11:22 +0200

linuxyz gravatar image

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.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2019-09-06 09:34:34 +0200

ajlittoz gravatar image

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!

edit flag offensive delete link more

Comments

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.

Mike Kaganski gravatar imageMike Kaganski ( 2019-09-06 12:43:55 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-09-06 09:11:22 +0200

Seen: 64 times

Last updated: Sep 06