title: C# Regex Match NOT inside self defined tags
body: <p>I use tags in the form of</p>
  
  <pre><code>[[MyTag]]Some Text[[/MyTag]]
  </code></pre>
  
  <p>To find these tags within the whole text I use the following expression (this is not related to this question here, but for info):</p>
  
  <pre><code>\[\[(?&lt;key&gt;.*\w)]\](?&lt;keyvalue&gt;.*?)\[\[/\1\]\]
  </code></pre>
  
  <p>Now I like to match and replace only text (MYSEARCHTEXT) which is NOT inside of these self definied tags.</p>
  
  <p>Example:</p>
  
  <pre><code>[[Tag1]]Here I don't want to replace MYSEARCHTEXT[[/Tag1]]
  But here MYSEARCHTEXT (1) should be replaced. And here MYSEARCHTEXT (2) needs to be replaced too.
  [[AnotherTag]]Here I don't want to replace MYSEARCHTEXT[[/AnotherTag]]
  And here I need to replace MYSEARCHTEXT (3) also.
  </code></pre>
  
  <p>MYSEARCHTEXT is a word or phrase and needs to be found 3 times in this example.</p>