-
Bug
-
Resolution: Fixed
-
P4
-
None
-
None
-
b15
java.util.regex.Matcher does not respect the boundary specified by the method region(int, int) when matching against a supplementary character.
The following code is expected to print "false", but prints "true":
import java.util.regex.*;
public class T {
public static void main(String[] args) throws Throwable {
Pattern p = Pattern.compile("\\ud800\\udc61");
Matcher m = p.matcher("\ud800\udc61");
m.region(0, 1);
System.out.println(m.find());
}
}
The following code is expected to print "false", but prints "true":
import java.util.regex.*;
public class T {
public static void main(String[] args) throws Throwable {
Pattern p = Pattern.compile("\\ud800\\udc61");
Matcher m = p.matcher("\ud800\udc61");
m.region(0, 1);
System.out.println(m.find());
}
}