Fixed the regex to match any prefix for TEL fields

This commit is contained in:
KnugiHK
2025-04-26 18:46:28 +08:00
parent 6dde72d330
commit 40dc3b657e

View File

@@ -72,7 +72,7 @@ def process_vcard(input_vcard, output_vcard):
# Regex to capture any telephone line.
# It matches lines starting with "TEL:" or "TEL;TYPE=..." or with prefixes like "item1.TEL:".
phone_pattern = re.compile(r'^(?P<prefix>(?:TEL(?:;TYPE=[^:]+)?|(?:.*\.)?TEL)):(?P<number>.*)$')
phone_pattern = re.compile(r'^(?P<prefix>.*TEL(?:;TYPE=[^:]+)?):(?P<number>.*)$')
for line in lines:
stripped_line = line.rstrip("\n")