Guessing from your question, I unerstand that you have groups of 5 to 6 digits, plus mixed in some single a-z characters (none or one per group).
If you have to only take these groups that match your constraints (at most one [a-z] in a group), then I have the following solution:
string pattern = @"\b[0-9][0-9][0-9][0-9][0-9][0-9a-z]?\b"
+ @"|\b[a-z][0-9][0-9][0-9][0-9][0-9]?\b"
+ @"|\b[0-9][a-z][0-9][0-9][0-9][0-9]?\b"
+ @"|\b[0-9][0-9][a-z][0-9][0-9][0-9]?\b"
+ @"|\b[0-9][0-9][0-9][a-z][0-9][0-9]?\b"
+ @"|\b[0-9][0-9][0-9][0-9][a-z][0-9]?\b"
;
This may look silly, but I don't come up with a better solution for the above stated problem. The issue is that you can not count how often a pattern was matched
before (e.g. the [a-z]).
Cheers
Andi