title: PHP : replace double spaces only between non-whitespace characters
body: <p>I have a date in this format (extracted from a specific script), on which I'd like to remove ALL spaces :</p>
  
  <pre><code>$date="Date:         Tue Aug  2 10:43"
  </code></pre>
  
  <p>Quite easy, but the trick is: prior to this, I'd like to add a "0" before the "2" (or any other 9th first days of the month), BUT the "0" has to replace the second space between "Aug" and "2".
  <strong>What is the best way to achieve this ?</strong></p>
  
  <p>Keep in mind that the date will (obviously) change each day, so we can't simply do something like this:</p>
  
  <pre><code>$date=str_replace("Aug  2","Aug 02",$date);
  </code></pre>
  
  <p>Instead, I think the best way would be to do something like:</p>
  
  <pre><code>$date=str_replace("[x]  [x]","[x] 0[x]",$date);
  </code></pre>
  
  <p>[x] meaning: "Any non-whitespace character" (please excuse me for this approximation !)</p>