You have put the whole first section of your regex in a character class (the square brackets, everything between [
and ]
. You don't need / want a character class as now you are only matching on length (all numbers are included in your char class).
So you can probably use something like (untested):
^((?:01|02|35|27|09|38|12|32|21|28|26|36|08|20|24|04|34|23|31|07|16|11|18|14|03|22|37|25|06|30|13|19|10|05|29|15|17|33)(?:\d{7}))|(\d{12})$
This should return all numbers of 12 characters (second section) or all numbers of 9 characters starting with the supplied sequences. If that is what you need...