code: private void newFilter() {
          RowFilter<MyTableModel, Object> rf = null;
          //If current expression doesn't parse, don't update.
          try {
              rf = RowFilter.regexFilter(filterText.getText(), 0);
          } catch (java.util.regex.PatternSyntaxException e) {
              return;
          }
          sorter.setRowFilter(rf);
      }
docs: Update the row filter regular expression from the expression in
  the text box.