I have the code
private String regexHHMM = "^([0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$";
The code does not compile with the error "Unclosed Character class"
This must be something very basic, is there any particular escaping I should be using, also I am mainly interested on WHY it cannot be accepted by the java compiler.
UPDATE: I have tried
Pattern.quote("^([0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$");
And now it compiles, but the regex does not match the HH:MM format now...
Pattern.quoteis for escaping all special character in the String, so that when it is compiled, the regex will match the characters in the original String literally.