title: How to hide certain rows via Regex with JQuery Datatable
body: <h1>Background</h1>
  <p>I have a datatables table of many rows of data; and a pair of custom buttons as per the Datatables documentation:</p>
  <pre><code>$(document).ready(function() {
     /* t is the datatable */
     var t = $('#dtabl').DataTable({
         ....
         ....
         buttons: [
              {
                  text: 'Hide Horse Academys',
                  action: function ( e, dt, node, config ) {
                      t.columns(1).search('some regex', true, true).draw();
                  }
              },
              {
                  text: 'Show Horse Academys',
                  action: function ( e, dt, node, config ) {
                      t.columns(1).search('', true, false).draw();
                  }
              }
       ]
      });
  });
  </code></pre>
  <p>These buttons should hide and show <strong>rows</strong> on the datatables where a certain column does or does not contain a certain text.</p>
  <p>The text I am trying to hide was originally all rows where the column contained the word &quot;academy&quot;;</p>
  <p>thus:</p>
  <pre><code>    {
         text: 'Hide Horse Academys',
         action: function ( e, dt, node, config ) {
            t.columns(1).search('^(?:(?!academy).)*', true, true).draw();
         }
      },
  </code></pre>
  <p>From this the Datatables search scans the column <code>(1)</code> for the text as per the <a href="https://datatables.net/reference/api/search()" rel="nofollow noreferrer">search documentation</a>.</p>
  <p>This uses a negative lookahead group to return finds which do not contain the value &quot;academy&quot;.</p>
  <p><strong>This works.</strong></p>
  <h1>The problem</h1>
  <p>I now have be asked to develop this to only hide academy's of a certain type, so jump academys should remain in view. I figure I could do this by having a parrallel search in place to:</p>
  <p><em>Only hide rows where the word &quot;academy&quot; appears and the word &quot;jump&quot; does not appear in the text.</em></p>
  <p>But this is proving hard to do, it seems to work on Regex101.com but I can't make it work in the  Javascript on the website;</p>
  <p>What I need  is:</p>
  <ul>
  <li>One line regex returns true if:
  <ul>
  <li>text does not contain 'academy' <strong>OR</strong></li>
  <li>text does contain 'academy' and does <strong>NOT</strong> also contain 'jump'</li>
  </ul>
  </li>
  </ul>
  <p>The code I have is:</p>
  <pre><code> t.columns(1).search('^(?:(?!.*academy.*).(?=.*jump.*))', true, true).draw();
  </code></pre>
  <p><em>Text that doesn't contain <code>academy</code> and does contain <code>jump</code></em></p>
  <p>The problem with this is it is showing <strong>only</strong> text that contains jump</p>
  <p>Furter development comes to this  - below -  which kind of works but sometimes misses matches;</p>
  <pre><code> t.columns(1).search('^(?:(?!.*academy.*)(?=.*jump.*|.*)).*', true, true).draw();
  </code></pre>
  <p>I have read various documentation on Javascript Regex (I am more familiar with PCRE) and also <a href="https://stackoverflow.com/a/10827606/3536236">this answer</a> but I can't see how I can fit what I need into the <code>datatables.search()</code> aspect.</p>
  <h1>Intended outcomes:</h1>
  <p><code>Academy of saddles</code> - Hide <em>(contains academy does not contain jump)</em><br>
  <code>Academy of jumps</code> - Show <em>(contains academy but also jump)</em><br>
  <code>Show jumping academy</code> - Show <em>(contains academy but also jump)</em><br>
  <code>Horse shoe surprise</code> - Show <em>(does not contain academy)</em><br>
  <code>Trailer Academy</code> - Hide <em>(contains academy does not contain jump)</em><br>
  <code>Jumpkick Academy</code> - Show <em>(contains academy but also jump)</em><br></p>
  <h1>Questions:</h1>
  <ul>
  <li>How can I create the desired ECMA Regex?</li>
  </ul>