Suppose you are documenting in LibreOffice Writer and in the middle of it you found that there exists a lot of extra space before every new line. It is a tedious job if you try to remove the extra space manually. Sometimes we encounter the same issue while copy pasting some documents from the web. Here I am going to explain a simple one step procedure to remove the extra space and new line in a LibreOffice document.
For a better understanding check the sample document below which contains a lot of spaces.
Our first intention is to remove the extra space before the new lines. For this you have to open the 'Find and replace' Dialog box. You can open this Dialog either from Edit --> Find and replace or by pressing Ctrl + H.
Then select the checkbox 'Regular expressions' by clicking the 'More Options' in the Dialog box. In the Dialog box enter ' +' (space+) in the 'Search for field' and leave the 'Replace with' field as empty.' +' can be used to remove one empty character.
'+' finds one or more of the characters in front of the "+". If you want to remove more than one character, you have to enter ' +'(spacespace+). Then click the 'Replace All' button. This will remove all the empty spaces in your document. Please check the image below for reference.
Now for the new lines in the document.
To do this open 'Find and replace' Dialog again and Enter '^$' in the 'Search for field' and leave the 'Replace with' field as empty. '^$' can be used to remove the empty paragraph. Then click the 'Replace All' button. This will remove all the new lines in your document. Please check the image below for reference.
Please note that I tested this property in Ubuntu 12.04 and LibreOffice 220.127.116.11.
I hope this method helps you to remove the entire space / new lines in the document.