// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class LicensePlates {
    private static final Pattern p = Pattern.compile("^([A-Z]{2})(?:[ ]*)([0-9]{3,5})$");
    public static void parse(String s) {
        Matcher m = p.matcher(s);
        if(m.find()) {
            System.out.println(m.group(1) + " " + m.group(2));
        } else {
            System.out.println("special");
        }
    }
    public static void main(String[] args) {
        parse("AA 1234");
        parse("AA 12");
        parse("ARNE");
        parse("AA                                         1234");
        parse("ABC 1234");
    }
}
