java rowfilter 正则表达式语言环境

java rowfilter regex Locale

我有一个填充的 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.