Frequently asked questions - Writer
From The Document Foundation Wiki
How do I eliminate the numerous line breaks that appear in text pasted into a document (for example text from an email)?
You need to use a regular expression:
- select ▸ menu;
- at the bottom left of the dialog box, click the More Options button;
- check Regular expressions;
- In the Find field, enter:
- $ to find the end-of-paragraph characters,
- ^$ to find the empty paragraphs (this paragraph mark ¶ at the start of paragraph = means an empty paragraph);
- click the Find button;
- to replace the line break by a empty space, enter a space in the Replace with field, then click the Replace;
- to replace the line break by nothing (only delete the character), click the Replace button (without entering anything in the Replace with field);
- if you have a lot of line breaks to replace, you can also use the Replace all button. You are recommended to save your document before using this option, as it may lead to unexpected consequences.
Other wildcards :
- for line breaks (obtained ⇧ Shift+↵ Enter) : \n;
- for tabs : \t.
Note : regular expressions don't work in the Replace with field.
For more information on regular expressions:
- search the help files for "Regular Expressions"