Java 使用CANON_EQ时预定义的字符类正则表达式匹配失败

Java 使用CANON_EQ时预定义的字符类正则表达式匹配失败,java,regex,Java,Regex,我添加了代码以支持正则表达式中的Unicode规范等价性。但是,当我使用预合成字符和一个预定义的字符类字符(如\s)时,匹配似乎失败 import java.util.*; import java.lang.*; import java.util.regex.*; class Main { public static void main (String[] args) throws java.lang.Exception { Pattern withCE = P

我添加了代码以支持正则表达式中的Unicode规范等价性。但是,当我使用预合成字符和一个预定义的字符类字符(如\s)时,匹配似乎失败

import java.util.*;
import java.lang.*;
import java.util.regex.*;

class Main
{
    public static void main (String[] args) throws java.lang.Exception
    {
        Pattern withCE = Pattern.compile("^a\u030A\\sx$",Pattern.CANON_EQ);
        Pattern withoutCE = Pattern.compile("^a\u030A\\sx$");
        String inputWithCE = "\u00E5 x";
        String inputWithoutCE = "a\u030A x";

        System.out.println("Matches with canon eq: " + withCE.matcher(inputWithCE).matches());
        System.out.println("Matches without canon eq: " + withoutCE.matcher(inputWithoutCE).matches());
    }
}
输出为:

Matches with canon eq: false
Matches without canon eq: true
请在此处尝试:


即使在使用规范等价选项编译正则表达式模式时,我也希望结果是“true”。我做错了什么

它使用Java 9+工作,我用Amazon Corretto 11测试过,它按照@Andreas的建议工作。