-
Type:
Bug
-
Resolution: Fixed
-
Priority:
P3
-
Affects Version/s: 5.0
-
Component/s: core-libs
-
b01
-
generic
-
generic
Regex nodes SingleA, NotSingleA, SingleU and NotSingleU always report the
hitEnd() to be true when match/find failed, even the "end" has not been reached.
The cases below show the problem.
// SingleA
p = Pattern.compile("^a", Pattern.CASE_INSENSITIVE);
m = p.matcher("bcd");
if (m.find() || m.hitEnd()) {
failCount++;
}
// NotSingleA
p = Pattern.compile("^[^\u4e00]", Pattern.CASE_INSENSITIVE);
m = p.matcher("\u4e00cd");
if (m.find() || m.hitEnd()) {
failCount++;
}
// SingleU
p = Pattern.compile("^\u4e00", Pattern.CASE_INSENSITIVE |Pattern.UNICODE_CASE);
m = p.matcher("abc");
if (m.find() || m.hitEnd()) {
failCount++;
}
// NotSingleU
p = Pattern.compile("^[^\u03b2]", Pattern.CASE_INSENSITIVE |Pattern.UNICODE_CASE);
m = p.matcher("\u0392bc");
if (m.find() || m.hitEnd()) {
failCount++;
}
hitEnd() to be true when match/find failed, even the "end" has not been reached.
The cases below show the problem.
// SingleA
p = Pattern.compile("^a", Pattern.CASE_INSENSITIVE);
m = p.matcher("bcd");
if (m.find() || m.hitEnd()) {
failCount++;
}
// NotSingleA
p = Pattern.compile("^[^\u4e00]", Pattern.CASE_INSENSITIVE);
m = p.matcher("\u4e00cd");
if (m.find() || m.hitEnd()) {
failCount++;
}
// SingleU
p = Pattern.compile("^\u4e00", Pattern.CASE_INSENSITIVE |Pattern.UNICODE_CASE);
m = p.matcher("abc");
if (m.find() || m.hitEnd()) {
failCount++;
}
// NotSingleU
p = Pattern.compile("^[^\u03b2]", Pattern.CASE_INSENSITIVE |Pattern.UNICODE_CASE);
m = p.matcher("\u0392bc");
if (m.find() || m.hitEnd()) {
failCount++;
}