title: Match all 'X' from 'Y' until 'Z'
body: <p>Well, I hope the title is not too confusing. My task is to match (and replace) all <code>X</code>s that are between <code>Y</code> and <code>Z</code>.</p>
  
  <p>I use <code>X,Y,Z</code> since those values may vary at runtime, but that's not a problem at all. </p>
  
  <p>What I've tried so far is this:</p>
  
  <pre><code>pattern = ".*Y.*?(X).*?Z.*";
  </code></pre>
  
  <p>Which actually works.. but only for one <code>X</code>. I simply can't figure out, how to match all <code>X</code>s between those "tags".</p>
  
  <p>I also tried this:</p>
  
  <pre><code>pattern = @"((Y|\G).*?)(?!Z)(X)"
  </code></pre>
  
  <p>But this matches all <code>X</code>s, ignoring the "tags".</p>
  
  <p>What is the correct pattern to solve my problem? Thanks in advance :)</p>
  
  <h1>Edit</h1>
  
  <p>some more information:</p>
  
  <p><code>X</code> is a single <code>char</code>, <code>Y</code> and <code>Z</code> are <code>strings</code></p>
  
  <p>A more real life test string:</p>
  
  <pre><code>Some.text.with.dots [nodots]remove.dots.here[/nodots] again.with.dots
  </code></pre>
  
  <p>=> match <code>.</code>s between <code>[nodots]</code> and <code>[/nodots]</code></p>
  
  <p>(note: I used xml-like syntax here, but that's not guaranteed so I can <em>unfortunately</em> not use a simple xml or html parser)</p>