I think you need to group your regex to get the start of string and end of string anchor to work, try
^([a-zA-Z]+[0-9]{6}|[0-9]{6}|[0-9]{9})$
Which has brackets after the start of string anchor and before the end of string anchor.
Without the brackets the start of string anchor applies to the first pattern and the end of string anchor applies to the second pattern so the middle pattern is allowed to match string of 6, 7 or 8 numbers.