title: Regex replace double spaces when not in SRC or HREF
body: <p>Currently I'm working on a project to strip all unnecessary HTML. I've got it al working but I'm using the following code to replace double spaces:</p>
  
  <pre><code>Private Function stripDubbleSpace(ByVal fileContent As String) As String
      While fileContent.IndexOf("  ") &lt;&gt; -1
          fileContent = fileContent.Replace("  ", " ")
      End While
      Return fileContent.Replace("  ", " ")
  End Function
  </code></pre>
  
  <p>The code above works, but within a HREF or and SRC the url will go to a 404 when you replace a double space by 1 space. Don't ask by why there are spaces in my URL, I'm aware that's not the best way.</p>
  
  <p>Example:<br />
  <code>/images/my  img.jpg</code> (2 spaces) would be replaced by <code>/images/my img.jpg</code> (1 space), which should not be replaced.</p>
  
  <p>How can I only replace the double spaces when it's not within a HREF or SRC?</p>