public class Main {
public static void main(String args[]) {
boolean retval = false;
String name = "first last";
String nameToken = "\\p{Upper}(\\p{Lower}+\\s?)";
String namePattern = "(" + nameToken + "){2,3}";
retval = name.matches(namePattern);
}
}