title: How to negate the Groovy Match Operator?
body: <p>The <a href="http://docs.groovy-lang.org/latest/html/documentation/#_regular_expression_operators" rel="noreferrer">documentation</a> mentions three regex specific operators:</p>
  
  <ul>
  <li><code>~</code> returning a <code>Pattern</code></li>
  <li><code>=~</code> returing a <code>Matcher</code></li>
  <li><code>==~</code> returning a <code>boolean</code></li>
  </ul>
  
  <p>Now, how can I negate the last one? (I agree that the others can't have any meaningful negation.)</p>
  
  <p>I tried the obvious thinking:</p>
  
  <pre class="lang-java prettyprint-override"><code>println 'ab' ==~ /^a.*/ // true: yay, matches, let's change the input
  println 'bb' ==~ /^a.*/ // false: of course it doesn't match, let's negate the operator
  println 'bb' !=~ /^a.*/ // true: yay, doesn't match, let change the input again
  println 'ab' !=~ /^a.*/ // true: ... ???
  </code></pre>
  
  <p>I guess the last two should be interpreted like this rather:</p>
  
  <pre><code>println 'abc' != ~/^b.*/
  </code></pre>
  
  <p>where I can see <code>new String("abc") != new Pattern("^b.*")</code> being <code>true</code>.</p>