小编San*_*tos的帖子

正则表达式 \p{Cs} 与 Java 16 中的符号不​​匹配

有谁知道为什么正则表达式\p{Cs}Java 16中的符号不​​匹配?它曾经在 Java 11 中匹配它。

爪哇 11

jshell 
|  Welcome to JShell -- Version 11.0.7
|  For an introduction type: /help intro

jshell> import java.util.regex.*

jshell> var text = new StringBuilder().appendCodePoint(55622).appendCodePoint(56380)
text ==> 

jshell> Pattern.compile("\\p{Cs}").matcher(text).find()
$3 ==> true
Run Code Online (Sandbox Code Playgroud)

爪哇 16

INFO: Created user preferences directory.
|  Welcome to JShell -- Version 16.0.1
|  For an introduction type: /help intro

jshell> import java.util.regex.*

jshell> var text = new StringBuilder().appendCodePoint(55622).appendCodePoint(56380)
text ==> 

jshell> Pattern.compile("\\p{Cs}").matcher(text).find()
$3 ==> false
Run Code Online (Sandbox Code Playgroud)

java regex java-11 java-16

4
推荐指数
1
解决办法
110
查看次数

标签 统计

java ×1

java-11 ×1

java-16 ×1

regex ×1