我有一个填充的 JTable
并有一个不区分大小写的行过滤器:
RowFilter rf = RowFilter.regexFilter("(?i)"+filterText.getText(), 0);
在使用本地化字母并在 JTextfield
中输入 åäöÅäÖ 之前,此功能正常工作。这些字母不区分大小写。
有人知道如何使正则表达式过滤器使用本地化字母吗?
最佳答案
根据我的评论回答这个问题:
如果您使用 UNICODE_CASE 标记您的Pattern
选项与不区分大小写的选项一起,您应该得到您需要的结果。
由于这是一个构造模式,因此只需在前面添加 (?iu)
而不是仅添加 (?i)
。
作为引用,文档中提到了 UNICODE_CASE
标志...
Enables Unicode-aware case folding.
When this flag is specified then case-insensitive matching, when enabled by the CASE_INSENSITIVE flag, is done in a manner consistent with the Unicode Standard. By default, case-insensitive matching assumes that only characters in the US-ASCII charset are being matched.
Unicode-aware case folding can also be enabled via the embedded flag expression (?u).
Specifying this flag may impose a performance penalty.
关于java rowfilter 正则表达式 区域设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52952825/