我试图避免从字符串中提取 IBAN 号码。例子:def get_umsatzsteuer_identifikationsnummer(string): # Demo --> https://regex101.com/r/VHaS7Y/1 reg = r'DE[0-9 ]{12}|DE[0-9]{9}|DE [0-9]{9}' match = re.compile(reg) matched_words = match.findall(string) return matched_wordsstring = "I want to get this DE813992525 and this DE813992526 number and this number DE 813 992 526 and this number DE 813992526. I do not want the bank account number: IBAN DE06300501100011054517."get_umsatzsteuer_identifikationsnummer(string)>>>>> ['DE813992525', 'DE813992526', 'DE 813 992 526', 'DE 813992526', 'DE063005011000']结果中的最后一个数字是德国 IBAN 号码(第一部分),我不想提取它。我怎样才能避免它?
添加回答
举报
0/150
提交
取消