I'm trying to write a regular expression for some particular license plates. They consist of one up to three capital letters, a hyphen, one up to two capitol letters and one up to four numbers. The license plate should not exceed the 8 symbols.
What I have until now is the following:
because there has to be at least one letter before the hyphen, I have this expression for the first letter: $$ P = (A\cup B \cup...\cup Z) $$
For the second letter: $$ D = (A\cup B \cup...\cup Z\cup empty) $$ empty indicates the possibility that there could not be a letter.
For the numbers is basically almost the same procedure: $$ E = (1\cup 2 \cup...\cup 9) $$ $$ F = (1\cup 2 \cup...\cup 9 \cup empty) $$
now for my explicit expression I think the answer would be: $$ K= PDD^* - PDEF^*F^* $$
but I'm not quite sure. I think this means I have 8 symbols, at least one letter before the hyphen but I could have up to three, the hyphen (that is a must), at least one letter after the hyphen but up to two and at least one number but I could have up to 4.
Something tells me I have something wrong here, I'm still new in the regular expressions world and I appreciate any help I could get in advance.