4
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中包含括号的字符串。在上面的代码中,字符串参数可以是: 约翰(史密斯)与RowFilter匹配的括号(regexFilter)
和列我在快乐搜索:
Jane (Doe)
John (Smith)
John (Smith)
Jack (Smith)
,我想它返回:
John (Smith)
John (Smith)
但现在它不会返回任何东西。我查看了Matcher,Pattern和RowFilter的文档,但迄今没有任何帮助。
这是真的吗? “我想让它回归的地方:约翰(史密斯)约翰(史密斯)',不是约翰(史密斯)和杰克(史密斯) – mKorbel
@mKorbel为什么不,列中包含两次约翰(史密斯)。 –