Strip all white spaces between words

How do I strip all white spaces between words?

Are you asking how to remove spaces between words in text?
Like this?

Maybe this would work.

1 Like

That's what I'm looking for.
Many thanks for the link.


Had a look at the link but got no joy.
They seem to be posts of some time ago.
I'm using Mac OS 10.14.6

I'm relatively new to Keyboard Maestro so might have got something wrong.
However, I was able to reproduce the macros shown.

Use the Search and Replace action, with search regular expression \s (any white space) and replacement `` (ie, nothing).

1 Like

I too am very new at this. Matter of fact I'm still in the trial period of the program. Just trying to find things to do with it myself.

1 Like

Might have got this wrong as it's not working for me.
Could you check it, please?

Delete everything in the "and replace with" field (leave it blank).

1 Like

@Joe_Quinn, just so you know, the RegEx metacharacter \s includes vertical white space as well, such as CR, LF. So if you want to remove all white spaces on EACH LINE and keep the lines intact, then you would want to use:

OR, for macOS prior to macOS 10.11, you should use:

So your KM Action would look like this:


Note: The "Replace" field is totally empty. The text you see, "Replace", is just a background label telling you what to enter.

1 Like

I've already seen and tried this from the link IDKFA provided at the top.

To be absolutely clear: I want to transform this the brown fox by highlighting
to this thebrownfox

And this, if I've got it right, is not doing it for me:

If you are just selecting the text you want to use, then you need to add a COPY Action first:


If that does not work, be sure to try the other RegEx patters that were suggested:


I just tried this and it works perfectly for me, running Keyboard Maestro 9.0.3 on macOS 10.14.6 (Mojave).

1 Like

This didn't quite do it for me, but then when I added a PASTE Action last .......BINGO!!
Many thanks to everybody for their input. Much appreciated.

1 Like