private void processInput() {
System.out.printf("\nPlease Enter your selection: (X)Exit, (MA1)Mark, (OB2)Open... ");
String inputString = readLine();
try {
handleInput(inputString);
}
catch (WrongFormatException ex) {
System.out.printf("%s", ex.getMessage());
}
}
private void handleInput(String input) throws WrongFormatException {
//...
if(matcher1.matches()) {
//...
}
else if (matcher2.matches()) {
//...
}
else if (matcher3.matches()) {
//...
}
else {
System.out.printf("Incorrect input!");
processInput();
}
}