I am trying to filter my table by value in text field but whenever I write anything to my text field all rows in table all filtered (so there are no rows displayed) even if the table contains that word or number.

```
public JTextField filterT = new JTextField();
private TableRowSorter<TableModel> sorter;

        sorter = new TableRowSorter<TableModel>(tm); //tm is my table model
        filterT.getDocument().addDocumentListener(new DocumentListener() {
            @Override
            public void insertUpdate(DocumentEvent e) {
                String text = filterT.getText();
                filter(text);
            }
            @Override
            public void removeUpdate(DocumentEvent e) 
            { 
                String text = filterT.getText();
                filter(text);
            }
            @Override
            public void changedUpdate(DocumentEvent e) {
                String text = filterT.getText();
                filter(text);
            }
          });

private void filter(String text)
{
    RowFilter<TableModel, Object> rf = null;
    try {
        rf = RowFilter.regexFilter(text, 0);
    } catch (java.util.regex.PatternSyntaxException ee) {
        return;
    }
    sorter.setRowFilter(rf);
    jTable1.setRowSorter(sorter);
}

```

What is wrong ?