TaxNumber extraction via RegEx

Hello KNIME Community,

I like to extract Taxnumbers via Regex. I know, in Europe a TaxNumber is max 14 diggits, the first to diggits are always values from A to Z and the values from 5 to 9 are always numbers.

I tried the following: (?[A-Z]{4}$|[A-Z]{2}\d{2}$|[A-Z]{3}\d{1}$|[A-Z]{2}\d{1}[A-Z]{1}$|[A-Z]{2}\s[^\s]+)$*. The result is, I got all the numbers, but also some garbage.

I think the problem is this part: [^\s]+)$.

My idea was: Extract all values which starts A to Z on digit 1 to 2 and only numbers on 5 to 9. min is 5 max is 14.


(?[A-Z]{2}\s*[0-9A-Z]{2}[0-9]{5}[0-9A-Z]*){1,14}$ - looks better.