title: Replace spaces with &nbsp; between PRE tags
body: <p>I need to extend the functionality of the following code snippet to convert spaces -only- between PRE tags in a string containing html:</p>
  
  <pre><code>str_replace(' ','&amp;nbsp;',$str);
  </code></pre>
  
  <p>For example, if $str cotained the following string;</p>
  
  <pre><code>&lt;p&gt;abc 123&lt;/p&gt;
  &lt;pre class="abc" id="123"&gt;abcedfg 12345&lt;/pre&gt;
  </code></pre>
  
  <p>it would be converted to:</p>
  
  <pre><code>&lt;p&gt;abc 123&lt;/p&gt;
  &lt;pre class="abc" id="123"&gt;abcedfg&amp;nbsp;12345&lt;/pre&gt;
  </code></pre>
  
  <p>similarly;</p>
  
  <pre><code>&lt;p&gt;abc 123&lt;/p&gt;
  &lt;pre&gt;abcedfg 12345&lt;/pre&gt;
  </code></pre>
  
  <p>would be converted to:</p>
  
  <pre><code>&lt;p&gt;abc 123&lt;/p&gt;
  &lt;pre&gt;abcedfg&amp;nbsp;12345&lt;/pre&gt;
  </code></pre>