You can use zero-width matches to exclude these two cases.
Not suitable AY:
(?!AY)
Does not match 11 identical characters. You either need to use backlinks (this means that the regular expression is not strictly regular anymore), or you can explicitly point to each digit.
(?!0{11}|1{11}|2{11}|…|9{11}) // 11 zeros, or 11 ones, or 11 twos, … (?!(.)\1{10}) // A character, followed by itself 10 more times.
So this will do full regexp:
(?!AY)(?!(.)\1{10})\w{2}\d{9}
source share