How to insert non-breaking spaces using 'replace all'?

Editing long documents with many people’s names, I want to replace the spaces after Mr, Ms, etc, with non-breaking spaces, in order to avoid the situation where the title is at the end of one line and the name on the next: Mr

I’m used to MS Word, where I can do this quickly and simply using ‘replace all’. But LibreOffice (which I’ve been using about a month) doesn’t seem to support non-breaking spaces in the replace all function. Finding them manually in a document of several hundred pages, when there are several on each page, is a drag and a time-killer! Is there a way to do this automatically or quickly?


LibreOffice does support non-breaking spaces both in the Find field and in the Replace field. What did you try exactly?

Also, try AltSearch.

I was trying to find something equivalent to the “caret characters” in MS Word, where you can type ^- into the search and replace box and it is interpreted as a non-breaking space. So "find: Mr " and “replace: Mr^-”
I found a list of “regular expressions” for LibreOffice but no non-breaking space in there. Found mention of “&nbsp” somewhere but that didn’t work.

There is no need to follow Microsoft’s stupidities. Just enter a plain non-breaking space. It works without any regular expressions or similar things.

Well that’s what I tried to do initially. But it doesn’t work – except by copy paste, as Przemo suggested. There’s no way, that I have found, of entering a non-breaking space directly into the find and/or replace box.

A non-breaking space can be entered directly using your operating system/graphic environment conventional method, for example, by Compose <space> <space> in Linux. Or right-click, select Special Character and pick a non-breaking space in the character map.

You can’t type it directly in the Find & Replace window with Ctrl-Shift-Space, but you can type "Mr " in the text, copy and paste in the Find & Replace window. Copying the non-breaking space on it’s own doesn’t work - that looks like a bug.

Thank you! Just tried that and it works. Don’t know why I didn’t think of it myself…

I can copy a no-break space (Unicode U+00A0) and paste it in the Replace: field.

Tested with LibreOffice (x86); OS: Windows 6.1.

Windows users can use Alt+0160.

Thank you! This works too (the Alt+0160). Bizarrely, when entered directly into the document itself it puts a non-breaking space after the character following the cursor!? But that’s not a bid deal and in the find and replace box works fine.

Alt+0160 puts a non-breaking space after the character following the cursor

Not with me.