Is there a way to globally reduce the number of hard returns

for instance I download text stories and in some of these there are 3 or 4 or more hard returns between paragraphs. Is there a way to globally reduce these to 2 hard returns so there is only one blank line between paragraphs? Thank you for your time

I’d suggest you using Alternative dialog Find & Replace for Writer (AltSearch) extension: https://extensions.libreoffice.org/extensions/alternative-dialog-find-replace-for-writer

Sorry. My posting had to sleep for a while, and then crossed yours.

Find and replace with regular expressions enabled; search say \n\n\n (three hard returns) and replace with \n\n. Repeat as necessary.

AFAICS it won’t work; in standard LO replace dialog, the regular expressions are limited to one paragraph.

@robleyd obviously assumed your (theOQ’s) “hard returns” were hard line breaks (Shift+Enter) while you had empty paragraphs in mind.
F&R cannot handle this as you correctly stated. The extension AltSearch can (to some degree).

@mikekaganski:
It works … →search: ^$ and replace with nothing, deletes any empty paragraph, and of course the distance between two Paragraphs should be regulated through the Paragraph-Format Settings.

:slight_smile: What works is what you posted, but that’s not what OP wants, neither what was suggested as solution. I refrain from arbitrarily modifying OP’s intent; I may figure quite a number of cases where using paragraphs is OK.

I has read the OP-post … and I repeat: Don’t try to “layout” your Docs with manually putting “whitespace”

Please don’t do that. No one here tried to manually layout anything here - that’s you who insists on things irrelevant to discussed topic. OP gets the text from external source; that source isn’t formatted as required - and needn’t be, as it’s apparently not a office-format. OP doesn’t express desire to spend time for (possibly substantial) work on “proper” formatting of (possibly one-time-read) texts; and so his question is OK (although template approach is also viable, but possibly overkill).

The OP ask for …replace by exactly one empty Paragraph thats IHMO manual Layout by whitespace.

This solution is not elegant, but it works to modify an entire document by replacing multiple (and variable numbers of) hard returns with single instances. Steps: 1. In the Find & Replace dialog box make sure under ‘Other options’ that ‘Regular expressions’ is checked, search for ‘$’ (no quotes), replace all with some flag or placeholder, e.g. ‘QWERTY’ 2. Use Find & Replace again, but with ‘Regular expressions’ unchecked, to remove multiple flags, leaving only those where you want a hard return. 3. Use Find & Replace, with ‘Regular expressions’ checked, to find all the remaining flags and replace them with ‘\n’ (no quotes).

(Edited by @Lupp:slight_smile:
Please note the third comment below concerning hard page breaks.

(Just kidding?)
Replacing all the $ with the chosen next_paragraph placeholder will make one single paragraph of all the text. As there is still a limit of 2 147 483 647 characters per paragraph the method may already fail for Writer documents of only about 50 000 pages.
(Up to LibO Writer V 4.2 the limit was only 65535. A significant limitation! Apache OpenOffice did not raise this limit yet.)

To remove all the multiple placeholders (QWERTY your example) I would suggest you work still with 'Regular expressions and ‘Serch For’ (QWERTY){2,}, ‘Replace With’ (empty).

Be aware of the fact that the workaround will spoil the hard page breaks if applied to the complete document or to a selection containing such breaks.