| in your regular expression allows it to match either of these two possibilities:
^[a-zA-Z]{2}[\d]{7} [\d]{10}$
That is, the beginning of the line, then 2 letters and seven numbers, followed by something, or something, followed by 10 numbers and the end of the line. Try the following:
/^([a-zA-Z]{2}\d{7}|\d{10})$/
(Note that I removed [] from each \d - it makes no sense to have a character class with one character in it.)
source share