String regex ="[A-Z]{4}[0-9]{7}"; List<String> non= new ArrayList<String>(); for (String container_no : container_noList) { if(!container_no.matches(regex)) { non.add(container_no); } }
String regex ="[A-Z]{4}[0-9]{7}"; List<String> non= new ArrayList<String>(); for (String container_no : container_noList) { if(!container_no.matches(regex)) { non.add(container_no); } }