I am trying to replace the paragraph characters with line break, can't figure it out. Doesn't have option for paragraph break, or does it, or i can't figure that out either

Have most recent version, 4.4.5 Using English, writer. I just downloaded this two days ago.

As best as I can tell, this can only be achieved with a macro due to an LO RE bug. Possible Macro help here (not accessible when I tried it). You can replace a Line-Break with a Paragraph, but not the other way around. Possible extension fix here.

If you are trying to do this via a macro:

  • Paragraph character (¶): U+000D CR Carriage Return (0x0013)
    (entered at keyboard with Enter key or Return key)
  • Line-Break character (↲): U+000A LF Line Feed (0x00010)
    (entered at keyboard with Shift+Enter key or Shift+Return key)

By menu (cannot work):

  • (menu):Edit|Find & Replace... (Ctrl+H)
    now select Other options then Regular expressions

This is not quite as straightforward as it may seem to those experienced with RE due to LO/OO quirks. The RE help says:-

$ on its own matches the end of a paragraph. This way it is possible to search and replace paragraph breaks.

However, if:-

Find: $
Replace: \n

Nothing happens on Replace all! (it just replaces a Pilcrow ¶ with another ¶). Here is why:-

LO Help on “\n”:

Represents a line break that was inserted with the Shift+Enter key combination. To change a line break into a paragraph break, enter \n in the Search for and Replace with boxes, and then perform a search and replace.


\n in the Search for text box stands for a line break that was inserted with the Shift+Enter key combination.


\n in the Replace with text box stands for a paragraph break that can be entered with the Enter or Return key.

What the Help does NOT say (and needs to say) is that, in general, RE cannot be used in the Replace box. Jeez, but that is annoying.

If helps then please tick the answer (:heavy_check_mark:).

1 Like

This is super helpful. And confusing also. Thanks!

1 Like

Hi

This is possible without macro:

  • Type a new line (Shift+Enter) in the (a) document, copy it
  • Edit Find & Replace
  • Search for: $
  • Other options check Regular expressions
  • Click Find All (all paragraph marks selected), keep the selection, close the dialog
  • Edit Paste, that’s it…

it is also possible to use AltSearch extension proposes many other possibility.

(Bump only. @Lupp )

1 Like

Thanks for your answer, it works for me. And indeed, the AltSearch extension works as well: \p matches a new paragraph and \n is a newline character. BTW, the URL of the AltSearch extension has changed: https://extensions.libreoffice.org/extensions/alternative-dialog-find-replace-for-writer

This old answer is still valid. The actions described by @pierre-ives samyn do the trick without relying on an extension or on a macro.

The mentioned extension AltSearch (“Alternative Find&Replace”) obviosusly isn’t fully maintained any longer and got its last update concerning LibO V 5.3.1.2, But if you have it installed its replacement string accepts \n actually meaning a hard line break. AltSearch uses \p for a paragraph break.