title: Mongo regex for "not match" or inverse
body: <p>My mongo documents all contain a field called <code>templateName</code>. There are a few documents that contain the value: <code>a_SystemDefaultTemplate</code>, <code>b_SystemDefaultTemplate</code>, <code>c_SystemDefaultTemplate</code> etc.</p>
  
  <p>I would like to <code>find</code> those documents whose templateName does not end with (or contain) <code>SystemDefaultTemplate</code></p>
  
  <p>I know it can be done using the <code>$not</code> operator like so:</p>
  
  <pre><code>db.collection.find({templateName: {$not: /.*SystemDefaultTemplate$/}})
  </code></pre>
  
  <p>But how do I do the same using regex?</p>
  
  <p>I have tried the below but it does not seem to work. </p>
  
  <pre><code>db.collection.find({templateName: {$regex: "^(.*SystemDefaultTemplate$)"}})
  </code></pre>