in reply to Looking for white spaces between words

Just for fun, a lookaround solution. When you find a space preceded by a space, or a space followed by a space, replace it:
s/(?<= ) | (?= )/&nbsp;/g;

The PerlMonk tr/// Advocate