protected void searchFilter(String s, int n)
{
RowFilter<MyTableModel, Object> rf = null;
try {
System.out.println(s);
rf = RowFilter.regexFilter(s, n);
} catch (PatternSyntaxException e) {
System.out.println(e);
}
filters.add(rf);
}
我正在尝试匹配 JTable 中包含括号的字符串。在上面的代码中,字符串参数可以是:John (Smith)
我正在搜索的列:
Jane (Doe)
John (Smith)
John (Smith)
Jack (Smith)
我希望它返回的地方:
John (Smith)
John (Smith)
但现在它没有返回任何东西。我查看了 Matcher、Pattern 和 RowFilter 的文档,但到目前为止没有任何帮助。