I don't know the exact zip rules in your country, but this snippet will get you started:
// define the pattern - should be defined as class field
// instead of + you could use {3,5} to match min. 3, max. 5 characters - see regular expressions manual
private static final Pattern PATTERN_ZIP = Pattern.compile("^[0-9A-Z]+[ \\-\\|]?[0-9A-Z]+$");
String zip = "1A2-3B4C5";
// Optional: let's make some text cleaning
String cleanZip = zip.toUpperCase().trim();
// Do the mat(c)h
Matcher m = PATTERN_ZIP.matcher(cleanZip);
if (m.find()) {
System.out.println("Zip code correct");
} else {
System.out.println("Zip code incorrect");
}