the code does not validate spaces and results into moving onto the next line of code to which it should keep in a continious loop until valid data is entered. I have a problem with matching for whitespaces using \s as it doesnt work. many thanks
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("^[^a-z,^A-Z,\\s]$")){
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("^[^a-z,^A-Z,\\s]$"));