I'm currently trying to to set up a program so the user must enter a specific string of characters for example DeskID followed by 2-3 ints, thus: DeskNO10 or DeskNO42
At the moment, I have tried:
if(Pattern.matches("[DeskNO0-9]",desk)) {
System.out.println("Accepted");
} else {
System.out.println("Rejected");
}
This doesn't work - is there any suggestions I could make it work or would it be advisable, if I just use a simple println statement using %s and %2d