Tuesday, 23 September 2014

Removing multiple spaces in OpenOffice/LibreOffice

I recently received several documents that contained multiple (and irregular) numbers of spaces between each word.  When I asked the original author about this, they said that they typed out the document and that they struggle with the gap a space produces being too small.  As I was meant to extract the information out of these documents and use it in a report and create a spreadsheet out of these I wanted to get rid of the multiple spaces so that I wouldn't have to re-type the whole thing. 

Microsoft office offers several ways to do this, however many of them do not work with OpenOffice or LibreOffice.  This is such a simple problem, but there are not many solutions to this shown online.

A simple fix is to use the Find & Replace tool (Ctrl + H or edit > Find & Replace from the top menu).  This will bring up a window (shown below).  In the Search for field enter [:space:]+ (be sure to include the symbols) and then in the Replace With field put in a space.  Click on the + symbol beside Other Options and select Regular expressions ( a tick should appear in the box beside it.

 Click on Replace All and your document should now be sorted, all of the multiple spaces will be replaced by a single space.


  1. I do this often in TextWrangler, but didn't know it could be done in LibreOffice. Will have to remember this.

  2. using regular expresion find and replace \s+ by \s

  3. Remember, this will obliterate any and all space-based indentation in your document.
    So use with care.

  4. How can I remove just the space before starts word?

  5. Thank you SO MUCH! You've saved me so much time.