title: How can I perform a case-insensitive filter on a JTable?
body: <p>I am making a table with a text field below it where you can type in a word to filter the table. It works, but what I want to do is be able to filter it with the word typed in, but ignoring the case of the word.  Is there a way to accomplish this without creating a custom <code>RowFilter</code>?</p>
  
  <p>You can run this SCCEE to see what I'm talking about. I want to be able to type in <code>usa</code> and it'll filter <code>USA</code>.</p>
  
  <pre><code>import java.awt.BorderLayout;
  import java.awt.event.ActionEvent;
  import java.awt.event.ActionListener;
  import javax.swing.JApplet;
  import javax.swing.JButton;
  import javax.swing.JLabel;
  import javax.swing.JPanel;
  import javax.swing.JScrollPane;
  import javax.swing.JTable;
  import javax.swing.JTextField;
  import javax.swing.RowFilter;
  import javax.swing.table.TableModel;
  import javax.swing.table.TableRowSorter;
  
  public class TestTableSortFilter extends JApplet {
  
      private String[] columnNames
              = {"Country", "Capital", "Population in Millions", "Democracy"};
  
      private Object[][] data = {
          {"USA", "Washington DC", 280, true},
          {"Canada", "Ottawa", 32, true},
          {"United Kingdom", "London", 60, true},
          {"Germany", "Berlin", 83, true},
          {"France", "Paris", 60, true},
          {"Norway", "Oslo", 4.5, true},
          {"India", "New Delhi", 1046, true}
      };
  
      private JTable jTable = new JTable(data, columnNames);
  
      private TableRowSorter&lt;TableModel&gt; rowSorter
              = new TableRowSorter&lt;&gt;(jTable.getModel());
  
      private JTextField jtfFilter = new JTextField();
      private JButton jbtFilter = new JButton("Filter");
  
      public TestTableSortFilter() {
          jTable.setRowSorter(rowSorter);
  
          JPanel panel = new JPanel(new BorderLayout());
          panel.add(new JLabel("Specify a word to match:"),
                  BorderLayout.WEST);
          panel.add(jtfFilter, BorderLayout.CENTER);
  
          add(panel, BorderLayout.SOUTH);
          add(new JScrollPane(jTable), BorderLayout.CENTER);
  
  
          jtfFilter.addActionListener(new ActionListener(){
              @Override
              public void actionPerformed(ActionEvent e) {
                  String text = jtfFilter.getText();
  
                  if (text.trim().length() == 0) {
                      rowSorter.setRowFilter(null);
                  } else {
                      rowSorter.setRowFilter(RowFilter.regexFilter(text));
                  }
              }
          }); 
      }
  }
  </code></pre>
  
  <p>Is there maybe something I can pass to the <code>regexFilter(text)</code>, that will give me the desired result?</p>
  
  <pre><code>rowSorter.setRowFilter(RowFilter.regexFilter(text));
  </code></pre>