Find double line breaks

LibreOffice 6.4.6.2 doesn’t find double line breaks by using the search string $$ in the FIND text box.
What can I do to find (and replace with something else) double line breaks?
Thanks in advance!

Hello,

Case 1: - Paragraph break (ENTER)

As per LibreOffice Help - Using Regular Expressions in Text Searches, which states:

A search using a regular expression will work only within one paragraph. To search using a regular expression in more than one paragraph, do a separate search in each paragraph.

you can’t do that, because double line breaks (i.e. end of paragraph entered by ENTER key) obviously span more than one paragraph.

Case 2: - Empty Paragraph

If you in fact want to replace empty paragraphs, use:

  • Menu Edit -> Find & Replace
    Find: ^$
    Replace: <whatever you want to be the replacement>
    Other Options 1: [x] Current selection only
    Other Options 2: [x] Regular expressions
  • Click Replace All

Case 3: - Line break (SHIFT+ENTER)

If you are talking about line breaks entered through SHIFT+ENTER use:

Use the following procedure:

  • Menu Edit -> Find & Replace
    Find: \n\n
    Replace: <whatever you want to be the replacement>
    Other Options 1: [x] Current selection only
    Other Options 2: [x] Regular expressions
  • Click Replace All

Hope that helps.

1 Like

Not clear in the question if you are searching for

some text¶
¶

or

some text¶
¶
¶

First example solved with case 2 of @anon73440385.

In the second example, you can face it with a few intermediate steps (before trying it, save your file; the formatting after that will be messed up):

  • Search for all $ with Regular expressions, and replace it for a character not used in the document (perhaps )
  • Search for all ██ “and replace with something else”
  • Search for all and replace with \n (to recover the paragraphs)

By the way, when searching for all ^$ and replacing for , double empty paragraphs will merge in one. Maybe a bug.


Add Answer is reserved for solutions. If you think the answer is not satisfactory, add a comment below, or click edit (below your question) to add more information. Thanks.

I had a document with a bunch of double line breaks when I needed 0 margins and tab indents.

I searched first for the regular expression ^$, and replaced it with QUINCE.

That left a whole bunch of new paragraphs, so I then, without undoing, replaced $ with QUINCE.

This left me with some QUINCE and some QUINCEQUINCE among a mass of words.

I replaced QUINCEQUINCE with \n\t and then QUINCE with \n.

Problem solved, looks perfect now (though the type formatting changed)

This was the most up-to-date version of LO as of Mar '24