@@ -2041,6 +2041,58 @@ public static void backRefTest() {
2041
2041
check (pattern , toSupplementaries ("abcdefghijkk" ), true );
2042
2042
}
2043
2043
2044
+ @ Test
2045
+ public static void ciBackRefTest () {
2046
+ Pattern pattern = Pattern .compile ("(?i)(a*)bc\\ 1" );
2047
+ check (pattern , "zzzaabcazzz" , true );
2048
+
2049
+ pattern = Pattern .compile ("(?i)(a*)bc\\ 1" );
2050
+ check (pattern , "zzzaabcaazzz" , true );
2051
+
2052
+ pattern = Pattern .compile ("(?i)(abc)(def)\\ 1" );
2053
+ check (pattern , "abcdefabc" , true );
2054
+
2055
+ pattern = Pattern .compile ("(?i)(abc)(def)\\ 3" );
2056
+ check (pattern , "abcdefabc" , false );
2057
+
2058
+ for (int i = 1 ; i < 10 ; i ++) {
2059
+ // Make sure backref 1-9 are always accepted
2060
+ pattern = Pattern .compile ("(?i)abcdef\\ " + i );
2061
+ // and fail to match if the target group does not exit
2062
+ check (pattern , "abcdef" , false );
2063
+ }
2064
+
2065
+ pattern = Pattern .compile ("(?i)(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)\\ 11" );
2066
+ check (pattern , "abcdefghija" , false );
2067
+ check (pattern , "abcdefghija1" , true );
2068
+
2069
+ pattern = Pattern .compile ("(?i)(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\\ 11" );
2070
+ check (pattern , "abcdefghijkk" , true );
2071
+
2072
+ pattern = Pattern .compile ("(?i)(a)bcdefghij\\ 11" );
2073
+ check (pattern , "abcdefghija1" , true );
2074
+
2075
+ // Supplementary character tests
2076
+ pattern = Pattern .compile ("(?i)" + toSupplementaries ("(a*)bc\\ 1" ));
2077
+ check (pattern , toSupplementaries ("zzzaabcazzz" ), true );
2078
+
2079
+ pattern = Pattern .compile ("(?i)" + toSupplementaries ("(a*)bc\\ 1" ));
2080
+ check (pattern , toSupplementaries ("zzzaabcaazzz" ), true );
2081
+
2082
+ pattern = Pattern .compile ("(?i)" + toSupplementaries ("(abc)(def)\\ 1" ));
2083
+ check (pattern , toSupplementaries ("abcdefabc" ), true );
2084
+
2085
+ pattern = Pattern .compile ("(?i)" + toSupplementaries ("(abc)(def)\\ 3" ));
2086
+ check (pattern , toSupplementaries ("abcdefabc" ), false );
2087
+
2088
+ pattern = Pattern .compile ("(?i)" + toSupplementaries ("(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)\\ 11" ));
2089
+ check (pattern , toSupplementaries ("abcdefghija" ), false );
2090
+ check (pattern , toSupplementaries ("abcdefghija1" ), true );
2091
+
2092
+ pattern = Pattern .compile ("(?i)" + toSupplementaries ("(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\\ 11" ));
2093
+ check (pattern , toSupplementaries ("abcdefghijkk" ), true );
2094
+ }
2095
+
2044
2096
/**
2045
2097
* Unicode Technical Report #18, section 2.6 End of Line
2046
2098
* There is no empty line to be matched in the sequence \u000D\u000A
0 commit comments