I need user input for a hexadecimal number so as long as their input contains the characters A-F
or 0-9
it won't re-prompt them.
This is what I have which runs as long as the inputed string contains A-F and or 0-9, it still runs if you add on other characters which I don't want.
do {
System.out.print("Enter a # in hex: ");
inputHexNum = keyboard.next();
} while(!(inputHexNum.toUpperCase().matches(".*[A-F0-9].*")));