Removing rows that do not contain search-term with jQuery
<p>I'm using the following JQuery to filter rows on a datatable, which works fine...</p>

<pre><code>yuiDtFilter = function(tableDivId, filter) {
     //custom jQuery function defines case-insensitive fn:Contains, use default fn:contains for case-sensitive search
     jQuery.expr[':'].Contains = function(a,i,m){
       return jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())&gt;=0;
     };
     $("#" + tableDivId + " .yui-dt-data").find('tr').hide();
     $("#" + tableDivId + " .yui-dt-data").find('td:Contains("' + filter + '")').parents('tr').show();
 }
</code></pre>

<p>However I have a need for the filter work in the opposite way. I need it to remove rows that <em>don't</em> match the search terms.</p>

<p>I've found out that I need to use 'not()', but I've spent most of the day in vain trying to get it to work (using every example I can find).</p>

<p>I've tried many variations of -</p>

<pre><code>$("#" + tableDivId + " .yui-dt-data")
    .find(:not(('td:Contains("' + filter + '")'))
    .parents('tr').remove();
</code></pre>

<p>Could anyone give me a hand using my code as a starting point?</p>
