title: Regex for "AND NOT" operation
body: <p>I'm looking for a general regex construct to match everything in pattern x EXCEPT matches to pattern y. This is hard to explain both completely and concisely...see <a href="http://en.wikipedia.org/wiki/Material_nonimplication">Material Nonimplication</a> for a formal definition. </p>
  
  <p>For example, match any word character (<code>\w</code>) EXCEPT 'p'. Note I'm subtracting a small set (the letter 'p') from a larger set (all word characters). I can't just say <code>[^p]</code> because that doesn't take into account the larger limiting set of only word characters. For this little example, sure, I could manually reconstruct something like <code>[a-oq-zA-OQ-Z0-9_]</code>, which is a pain but doable. But i'm looking for a more general construct so that at least the large positive set can be a more complex expression. Like match <code>((?&lt;=(so|me|^))big(com?pl{1,3}ex([pA]t{2}ern)</code> except when it starts with "My".</p>
  
  <p><strong>Edit</strong>: I realize that was a bad example, since excluding stuff at the begginning or end is a situation where negative look-ahead and look-behind expressions work. (Bohemian I still gave you an upvote for illustrating this). So...what about excluding matches that contain "My" somewhere in the middle?...I'm still really looking for a general construct, like a regex equivalent of the following pseudo-sql</p>
  
  <pre><code>select [captures] from [input]
  where (
      input MATCHES [pattern1]
      AND NOT capture MATCHES [pattern2]
  )
  </code></pre>
  
  <p>If there answer is "it does not exist and here is why..." I'd like to know that too.</p>
  
  <p><strong>Edit 2</strong>: If I wanted to define my own function to do this it would be something like (here's a C# LINQ version): </p>
  
  <pre><code>public static Match[] RegexMNI(string input, 
                                 string positivePattern, 
                                 string negativePattern) {
      return (from Match m in Regex.Matches(input, positivePattern)
              where !Regex.IsMatch(m.Value, negativePattern)
              select m).ToArray();
  }
  </code></pre>
  
  <p>I'm STILL just wondering if there is a native regex construct that could do this. </p>