I wrote this method to check if the code valid or not:
private boolean validateDeleteBacklog(String code) {
if(code != null && !code.equals("")) {
if(code.length() == 6) {
Pattern specialCaracter = Pattern.compile("[$&+,:;=?@#|'<>.-^*()%!]");
boolean specialCar = specialCaracter.matcher(code).matches();
return specialCar;
}
}
return false;
}
when i use code = "abc123" it return always false inside of true. Where is the problem here?