How to add line break to search and replace

In many documents I have the following:

| | * 

What I require is

| | 

i.e. I need to find | | * and replace this with | | and then a line break and then *

How do I do this? Any help greatly appreciated :slight_smile:

If I understand correctly (and asterisk is a literal * rather than a wildcard), then you need to:

  1. Do CTRL-H to bring up the Find & Replace dialog
  2. Click on “More Options” (bottom left button)
  3. Make sure “Regular expressions” is checked/selected
  4. Then in your “Search for” box, enter:
    \| \| \* and in the “Replace with” enter: | | \n*

That should do it. (Although in your example, you have some spaces in front of the asterisk?) You might want to un-check “Regular expressions” next time you do search-replace.

For more help on Regular Expressions, have a look at the LibreOffice help, or this useful OpenOffice “how-to”.

Thanks David,
Works just as required :slight_smile:

Great help… Thanks a lot :wink:

This solution is out-dated. \n is no longer a Line-Break. it is a Carriage-Return 2021/03/29.
(searching for a way for Find&Replace to add a Line-Break.)
ps: on a Mac: find works with \n and finds a New-Line character. The Replace portion writes a \n as a Paragraph character!

David’s Find and Replace steps do work, but I’ve found the Alternative Dialog Find & Replace extension to be easier to use (and has more options):

@Edward3 - great extension, and I use it quite a bit. Not sure how it helps in this particular case, though, and it can be tricky to use. Could you help out OP by suggesting how you would use this extension to accomplish his search/replace? Thanks!

Great help… Thanks a lot :wink: