Replacing blank space at the beginning and end of paragraphs in LibreOffice Writer

So I figured out how to replace blank spaces at the beginning and end of paragraphs in LibreOffice Writer. In Word, it’s as simple as searching for ^P with spaces before or after the ^P and replacing them with whatever you want to replace them with. Not so with LibreOffice Writer, but also not as impossible as I thought it was either. :-)

You might not remember that a while back I wrote: “Writer can’t find and replace ^P paragraph marks. That matters to me because I sometimes mistakenly put a space as the first letter of a paragraph and a quick search and replace before I do my final spell check takes care of that in Word. (Microsoft Word or LibreOffice Writer?)

This common little task was one of the reasons I was having trouble getting used to using LibreOffice Writer after using Word 2007 for many years.

I found a solution a while back, and I thought I’d point it out in case anyone else needs to know.

The parenthetical comments are there to make it easier to see what actually needs to go into the search box because spaces don’t really show themselves as characters. :-)

Search Replace What it does
^ 
(^space)
blank Removes blank space at start of paragraph (LibreOffice) (search using regular expression)
 *$
(space*$)OR
\s+$
blank Removes blank space at end of paragraph (LibreOffice) (search using regular expression)

OR second option removes all whitespace characters including non-breaking spaces

Be sure to select the option to search using regular expression for these searches.