Regular expression search and replace does not work - Writer

Hi

I have a very large document with a lot of lines ending with: a hyphen followed by a space followed by a line break.

I would like to remove those so that the next line moves up to complete the first line.

I realize this probably sounds confusing. I have attached a file with an example and the desired result. I hope that clarifies it.

I tried searching for “- \n” (without the quote marks) but when I try it says “search key not found”.
When I use “- *” the hyphen and the space are removed but the line break isn’t.

Hope anyone can help.

Thanks!

Untitled 9.odt

In LibreOffice, regular expressions are limited to a single paragraph. The paragraph boundary (the imaginary “\n”) is not affected by replacement. The only exceptions are single $ (that can be used to join all paragraphs together) and ^$ which finds empty paragraphs; these regexes are able to remove paragraph boundaries. In your case, the workaround could be replacing all newlines ($) with a unique sequence, then searching in resulting single paragraph, then replacing unique sequences left back with newlines.

If I try to search for $ I also get Search key not found.

Is “Regular expressions” checked in Find & Replace dialog?

It works! Thanks.