title: How can I delete whitespace from middle of string but keep whitespace at beginning?
body: <p>Sometime years ago ALL of our Apache config files changed to have whitespace all over the place (see below, no idea who did it). Since I am upgrading from 2.2 to 2.4 this makes it tricky to find and replace all the required config changes.</p>
  
  <p>I thought to get rid of the whitespace in the middle but keep the whitesapce at the front. I know how to replace at the beginning, end and everywhere. I even consulted a few books (e.g. Jeff Friedl's regexp) but I cannot get my head around this - not even sure whether this is possible.</p>
  
  <pre><code>  &lt;Directory            "THEDIRECTORY"&gt;
      &lt;LimitExcept        GET POST&gt;
        deny              from all
      &lt;/LimitExcept&gt;
      Options             -Indexes -MultiViews
      AllowOverride       All
      Order               allow,deny
      Allow               from all
    &lt;/Directory&gt;
  </code></pre>
  
  <p>What I would like is this:</p>
  
  <pre><code>  &lt;Directory "THEDIRECTORY"&gt;
      &lt;LimitExcept GET POST&gt;
        deny from all
      &lt;/LimitExcept&gt;
      Options -Indexes -MultiViews
      AllowOverride All
      Order allow,deny
      Allow from all
    &lt;/Directory&gt;
  </code></pre>
  
  <p>So I can easily search for and replace the config changes for apache 2.4</p>
  
  <p>I thought coming from the end</p>
  
  <pre><code>s/\s+(.*)\s+(.*)\s+$/$1$2/g
  </code></pre>
  
  <p>but this does not work for a number of reasons including that the number of replacements change, they are a non fixed number.</p>
  
  <p>Help please, I am clueless.</p>