First of all, you are trying to do this with difficulty. I suspect that this may not be possible, but you will have to apply some artificial intelligence methods, and it will be much more difficult than it is worth. Any neural network or genetic algorithm system can be trained to recognize the numbers Z and T numbers, assuming that the format Z[0-9]+ and T[0-9]+ always used somewhere in the regular expression.
What I will do with this problem is to write a Python script to handle all file names. In this script, I would match the file name twice, once I looked for Z[0-9]+ and once I looked for T[0-9]+ . Each time, I calculated matches for Z-numbers and T-numbers.
I would save four other counters with current totals, two for Z-numbers and two for T-numbers. Each pair will represent the number of file names with 1 match and those that have multiple matches. And I would calculate the total number of files processed.
In the end, I would say the following:
nnnnnnnnnn filenames processed Z-numbers matched only once in nnnnnnnnnn filenames. Z-numbers matched multiple times in nnnnnn filenames. T-numbers matched only once in nnnnnnnnnn filenames. T-numbers matched multiple times in nnnnnn filenames.
If you're lucky, there will be no matches, and you can use the above expressions to extract your numbers. However, if there is any significant number of matches, you can run the script again with some print statements to show you examples of file names that cause multiple matches. This will tell you if a simple regex setup can work.
For example, if you have 23,768 multiple matches in T numbers, make a script print every 500th file name with multiple matches, which will give you 47 samples to check.
Probably something like [ -/.=]T[0-9]+[ -/.=] Would be enough to combine multiple matches to zero, as well as give a one-time match for each file name. Or in the worst case, [0-9][ -/.=]T[0-9]+[ -/.=]