Here’s the problem I was facing. I had a document with a lot of text that I had to analyze. The text had been copied from a spreadsheet and pasted without formatting to get rid of the cells. As a result, there was a single “return” or “paragraph break” between each passage of text. That made it difficult to know when one passage of text ended and the other began, even if I turned on non-printing characters (called “formatting marks” in LibreOffice). This screenshot illustrates the challenge:
In the screenshot above, I don’t have non-printing characters or formatting marks turned on so I can’t see that there are actually two paragraphs here with a paragraph break or return in the middle of that paragraph. When I toggle formatting marks in LibreOffice, I can now see the paragraph break (or carriage return) in the middle of the paragraph, but the paragraph still seems to bleed right through.
What I wanted to do was find all the paragraph breaks (or returns or carriage returns) and double them, so there were clear breaks between each paragraph. This is possible using the Find and Replace window in LibreOffice (Edit -> Find and Replace or CTRL + H).
However, my initial efforts to solve this problem didn’t work because there was some confusion over regular expressions. The LibreOffice documentation includes a list of regular expressions here. In case you’re not aware, regular expressions are basically combinations of characters that can be used to find different items in a file. For instance, “^” will find the beginning of a paragraph.
Where my confusion came in is that “$” will find the end of a paragraph, which is what I wanted. So, that was a good start. But entering “$$” into the replace field in the Find and Replace dialogue in LibreOffice replaced the paragraph break with two dollar signs, not two paragraph breaks. It turns out, the dollar sign symbol “$” only works to find paragraph breaks. To insert paragraph breaks, you need a different regular expression: “\n”. To add two of them, I used “\n\n”.
Here is what I used in my Find and Replace dialogue to replace all my single paragraph breaks with double paragraph breaks:
Clicking “Replace All” made this change on all 12 pages of the document. Here’s that same paragraph, but with two paragraph breaks.
432 total views, 5 views today