java rowfilter 正则表达式 区域设置

标签 java regex jtable rowfilter

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

相关文章:

python - 竖线文字如何确定python中的正式正则表达式?

java - 如何保持 JTabe 窗口的焦点直到用户响应?

java - 如何指示 Mapstruct 使用 lombok builder?

java - ZonedDateTime更改行为jdk 8/11

java - 容器加载后运行代码 - 资源加载

正则表达式自动增量替换

javascript - 删除所有 "function foo() { ... }"并显示其他内容的正则表达式是什么?

Java - ResultSet 更改数据库列名称以在 JTable 中显示

java - 通过setDataVector函数更新JTable数据

java - 更改语言 三星 S8+