title: Regex replace text but exclude when text is between specific tag
body: <p>I have the following string:</p>
  
  <pre><code>Lorem ipsum Test dolor sit amet, consetetur sadipscing elitr, sed diam nonumy &lt;a href="http://Test.com/url"&gt;Test&lt;/a&gt; eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd sed Test dolores et ea rebum. Stet clita kasd gubergren, no sea &lt;a href="http://url.com"&gt;Test xyz&lt;/a&gt; takimata sanctus est Lorem ipsum dolor sit amet.
  </code></pre>
  
  <p>Now I would replace the string 'Test' outside of tags an not between tags (e.g. replaced with '1234').</p>
  
  <pre><code>Lorem ipsum 1234 dolor sit amet, consetetur sadipscing elitr, sed diam nonumy &lt;a href="http://Test.com/url"&gt;Test&lt;/a&gt; eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd sed 1234 dolores et ea rebum. Stet clita kasd gubergren, no sea &lt;a href="http://url.com"&gt;Test xyz&lt;/a&gt; takimata sanctus est Lorem ipsum dolor sit amet.
  </code></pre>
  
  <p>I started with this regex: <code>(?!&lt;a[^&gt;]*&gt;)(Test)([^&lt;])(?!&lt;/a&gt;)</code></p>
  
  <p>But two problems are not solved:</p>
  
  <ol>
  <li>The text 'Test' gets also replaced inside Tags (e.g. <code>&lt;a href="http://Test.com/url"&gt;</code>)</li>
  <li>Does the text between the tag not exactly match the searched text, it will be also replaced (e.g. <code>&lt;a href="http://url"&gt;Test xyz&lt;/a&gt;</code>)</li>
  </ol>
  
  <p>I hope someone has a solution to solve this problem.</p>