title: replace multiple spaces in a string with a single space
body: <p>I have a file with has several spaces among the words at some point. I need to clean the file and replace existing multi-spaced sequences with one space only. I have written the following statement which does not work at all, and it seems I'm making a big mistake.</p>
  
  <pre><code> $s = preg_replace("/( *)/", " ", $x);
  </code></pre>
  
  <p>My file is very simple. Here is a part of it:</p>
  
  <pre><code>Hjhajhashsh dwddd dddd sss   ddd wdd ddcdsefe xsddd   scdc yyy5ty    ewewdwdewde           wwwe ddr3r dce eggrg               vgrg fbjb   nnn  bh jfvddffv mnmb   weer ffer3ef f4r4 34t4 rt4t4t 4t4t4t4t    ffrr  rrr  ww w w ee3e iioi   hj   hmm  mmmmm mmjm lk ;’’ kjmm  ,,,, jjj hhh  lmmmlm m mmmm lklmm jlmm m
  </code></pre>