title: Use regular expression in Xcode to exclude phrased from find results
body: <p>I need to find in project files all occurrences of <code>&lt;LIB&gt;</code> or <code>&lt;M&gt;</code> but only if there is no <code>&lt;TOLERATED&gt;</code>.</p>
  
  <p>E.g. find all this:</p>
  
  <pre><code>// &lt;M&gt; a bit of code
  // &lt;LIB&gt; rename with prefix
  </code></pre>
  
  <p>But don't show these:</p>
  
  <pre><code>// &lt;M&gt;&lt;TOLERATED&gt; a bit of code
  // &lt;TOLERATED&gt;&lt;LIB&gt; rename with prefix
  </code></pre>
  
  <p>My tries:
  This gives you results with both <code>&lt;LIB&gt;</code> and <code>&lt;TOLERATED&gt;</code>: <code>&lt;LIB&gt;(.*?)TOL</code>
  Then I've tried to negate the <code>&lt;TOLERATED&gt;</code> with: <code>&lt;LIB&gt;(.*?)(?!TOL)</code> but that gives me back lines with both <code>&lt;LIB&gt;</code> and <code>&lt;TOLERATED&gt;</code></p>
  
  <p>I've tried many other ways to exclude the <code>&lt;TOLERATED&gt;</code> from the search results but none of them worked: </p>
  
  <pre><code>&lt;LIB&gt;(?!TOL\b)\b\w+
  &lt;LIB&gt;(.*?)(?!TOL\b)\b\w+
  &lt;LIB&gt;(.*?)(?&lt;!TOLERATED)
  &lt;LIB&gt;(.*?)+\b(?&lt;!\bTOLERATED)
  </code></pre>
  
  <p>and many others.</p>
  
  <p>What I've been looking at:
  <a href="https://stackoverflow.com/questions/4124111/regexp-in-xcode-exclude-matches-from-result-set">RegExp in Xcode: exclude matches from result set?</a></p>
  
  <p>Thanks for your help --Josef</p>