I am trying to extract the German VAT number (Umsatzsteuer-Identifikationsnummer) from a text.
string = "I want to get this DE813992525 number."
I know, that the correct regex for this problem is (?xi)^( (DE)?[0-9]{9}|)$
.
It works great according to my demo.
What I tried is:
string = "I want to get this DE813992525 number.
match = re.compile(r'(?xi)^( (DE)?[0-9]{9}|)$')
print(match.findall(string))
>>>>>> []
What I would like to get is:
print(match.findall(string))
>>>>> DE813992525