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.
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.
  <Directory            "THEDIRECTORY">
    <LimitExcept        GET POST>
      deny              from all
    </LimitExcept>
    Options             -Indexes -MultiViews
    AllowOverride       All
    Order               allow,deny
    Allow               from all
  </Directory>
What I would like is this:
  <Directory "THEDIRECTORY">
    <LimitExcept GET POST>
      deny from all
    </LimitExcept>
    Options -Indexes -MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
  </Directory>
So I can easily search for and replace the config changes for apache 2.4
I thought coming from the end
s/\s+(.*)\s+(.*)\s+$/$1$2/g
but this does not work for a number of reasons including that the number of replacements change, they are a non fixed number.
Help please, I am clueless.
 
     
    