I have some problems with the pattern in Java. I followed all of the steps in Regex but these lines of code are not working!
Pattern p = Pattern.compile("[a-zA-Z]{4}-[0-9]{1}");
if (p.matcher(id).matches())
this.id = id;
else
System.out.println("Wrong format!");
Whenever I type ABCD-0123, it is false and prints out wrong format