Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Looks like you either need to create a separate filter for each column and combine them with an <a href="http://java.sun.com/javase/6/docs/api/javax/swing/RowFilter.html#andFilter%28java.lang.Iterable%29" rel="noreferrer">AndFilter</a>, or write your own filter by overriding the <a href="http://java.sun.com/javase/6/docs/api/javax/swing/RowFilter.html#include%28javax.swing.RowFilter.Entry%29" rel="noreferrer">include()</a> method. A RegexFilter only requires one of the specified columns to match, and there doesn't seem to be a way to change that.</p> <p>By the way, if you want to force the regex to ignore case, you should add <code>(?i)</code> to the beginning of it. The string you're generating is the same as the one you started with, despite your use of the CASE_INSENSITIVE flag.</p> <p>EDIT: The doc I linked to contains an example of creating an AndFilter from two RegexFilters, but the example is pretty silly. It creates a filter that looks for <code>foo</code> in any column or <code>bar</code> in any column--which is exactly the same as a single RegexFilter with <code>foo|bar</code> as the regex and no columns specified. A good AndFilter example should do something only an AndFilter can do: enforce conditions on two or more columns at once, like you're trying to do. Here's how I would filter case-insensitively for <code>Zac</code> in the first column and <code>A</code> in the second:</p> <pre><code>List&lt;RowFilter&lt;Object,Object&gt;&gt; rfs = new ArrayList&lt;RowFilter&lt;Object,Object&gt;&gt;(2); filters.add(RowFilter.regexFilter("(?i)^Zac$", 0)); filters.add(RowFilter.regexFilter("(?i)^A$", 1)); RowFilter&lt;Object,Object&gt; af = RowFilter.andFilter(rfs); </code></pre> <p>Also, if I were accepting the filter text as user input (which you seem to be doing), I would probably quote it first:</p> <pre><code>String regex = "(?i)^" + Pattern.quote(input) + "$"; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload