Connect single word in a paragraph to preceding and following paragraphs, using AltSearch in LibreOffice Writer

Let me say first that this will likely be a hack that most of you will never need, but for those who do need it, it's a godsend. 

Background

I convert a LOT of public domain books from their original formats (pdf, epub, txt, etc.) into cleaned-up, easy-to-read and easy-to-use formats, mostly into .odt files. One of the sources of those Public Domain files is Early English Books online. This fix is predicated on EEBO as the source material, but anyone who uses any method of converting text from one format to another might have a need for this fix.

Notice

The fix is predicated on (1) the use of LibreOffice Writer, and (2) the installation of of the LibreOffice add-in "Alternate Search and Replace" (AltSearch). 

The Issue

Unfortunately, when I search for a book on EEBO, then choose to copy "All Text" and paste it into a new LibreOffice Writer (.odt) document, most likely the word for which I searched in EEBO, in this case "God," is left hanging out in individual, one-word paragraphs. 

The Need

What I need is to be able to do a mass replace (832 instances) of the one-word "God" paragraphs, so that ^God$ (using Regular Expressions) becomes connected to both the preceding and following paragraphs. Here's what those pesky paragraphs look like:

This is the first part of the paragraph to which I want the word
God
connected to both the first and last parts of the paragraph.

This is what the end result should look like: 

This is the first part of the paragraph to which I want the word God connected to both the first and last parts of the paragraph.

I want to pause here and say that, while frequently I use LO Writer's baked-in"Regular Expressions" function within the standard Find and Replace, I could not use that method to figure out how to do what I wanted to do, so I turned instead to the LO Writer add-in, "AltSearch." 

The Fix

So, here's what the fix looks like, using AltSearch.


Note that in the Replace field the word God is preceded and followed by single spaces that do not appear in the image above. which results in a bunch of double-spaces that are much easier to mass-clean-up, rather than, in this case, having to go back and add a single space before and after 832 instances of the word God.

We recommend you bookmark this blog. Trying to find helpful information in forums usually just ends in making you frustrated and angry. This blog does not speculate or guess. If we post it, we've tried it and it works.



Comments

Popular posts from this blog

LibreOffice Freeze and Slowdown - "Memory" and "Undo" Settings

Creating an Epub file with a clickable TOC using Libreoffice and Google Docs

LibreOffice : Stop Breaking Your "Document Hyperlinks" (Document Links)