title: Replace a string with another in HTML but no in HTML tags and attributes PHP
body: <p>I need to load a HTML (maybe with DOMDocument loadHTML) and then replace all words A with word B but nothing inside an html tag.</p>
  
  <p>This means that in the following html if we need to replace the word 'test' with 'TEST' it will only replace the text 'this is a test' with 'this is a TEST' and will keep intact the id="test"</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;&lt;/head&gt;
  &lt;body&gt;
    &lt;div id="test"&gt; this is a test &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>