Stuck on trying to limit a persons name to say 20 characters in a string or a phone number to 6 characters in a string, i cant get the {} inside or after regex to work with either a minimium or maximium number so that in my loop if a persons name is over 20 chracters then it will continual loop or i.e. phone number is less than 6 or more than 6 chracters it will keep looping, any help would be great the internet does not have better explation for this stuff so any one that understands it would be doing me a huge favour to understand this complex stuff, thanks.. sample code would be
do{
/*if salesPersonName is null or just spaces then this
piece of code runs, displaus output and asks for input
which salespersoname = input 2
*/
if (salesPersonName.matches("^[\\s]+$")||salesPersonName.matches("")||salesPersonName.matches("^[0-9]+$")){
System.out.println("Sales person's name can not"
+ " be empty or have space, must contain "
+ "a-z characters");
System.out.println("Enter Sales Person Name;");
salesPersonName = input2.nextLine();
}
//keeps looping until input is not null or contains just spaces
} while (salesPersonName.matches("^[\\s]+$")||salesPersonName.matches("")||salesPersonName.matches("^[0-9]+$"));