Ask Your Question

How to add line break to search and replace [closed]

asked 2013-08-26 11:02:07 +0200

updated 2020-08-16 12:51:03 +0200

Alex Kemp gravatar image

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 :)

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2015-11-07 10:59:48.146084

2 Answers

Sort by » oldest newest most voted

answered 2013-08-26 11:54:32 +0200

David gravatar image

updated 2013-08-26 12:13:01 +0200

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".

edit flag offensive delete link more



Thanks David, Works just as required :)

Gary gravatar imageGary ( 2013-08-27 02:27:19 +0200 )edit

Great help.. Thanks a lot ;-)

sreehari.sathyanandan gravatar imagesreehari.sathyanandan ( 2015-02-15 05:59:59 +0200 )edit

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!

Glake gravatar imageGlake ( 2021-03-28 16:09:51 +0200 )edit

answered 2013-08-26 17:31:12 +0200

Edward gravatar image

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):

edit flag offensive delete link more


@Edward - 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!

David gravatar imageDavid ( 2013-08-26 18:08:29 +0200 )edit

Great help.. Thanks a lot ;-)

sreehari.sathyanandan gravatar imagesreehari.sathyanandan ( 2015-02-15 05:59:04 +0200 )edit

Question Tools

1 follower


Asked: 2013-08-26 11:02:07 +0200

Seen: 57,283 times

Last updated: Aug 26 '13