http://qs321.pair.com?node_id=501836


in reply to Regular Expressions: Removing 'only' single spaces from a string

The OP asked to remove single spaces, not whitespaces. He did not mention about word-boundaries either; and even if he did, we don't know if the language he is using is covered under the \b concept of Perl. And therefore, to obey the bounds of the original request, here is another solution using negative lookahead.
s/\ (?!\ )//gx ;