I am trying to replace all international phone numbers in a python column (mostly European ones).
Currently I have:
df['A'] = df['A'].replace('^(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})(?:\s*(?:#|x\.?|ext\.?|extension)\s*(\d+))?$',r'\Tel', regex=True)
I am following this well-known question on here: A comprehensive regex for phone number validation
But somehow, this phone number: 04265-217866
is not reached by this. Any ideas how to tune it?
The data in df['A'] is german text data and looks like:
df['A']
Sehr geehrter Herr... Mit freundlichen Grüßen 0049-172 387898
Ich hoffe ich konnte helfen 0021 111789
Sie erreichen mich unter 04265-217866
The desired outcome in this case would be:
Sehr geehrter Herr... Mit freundlichen Grüßen Tel
Ich hoffe ich konnte helfen Tel
Sie erreichen mich unter Tel
My phone numbers are European(german) numbers:
0049 231 184989
+49 231 184989
0049231184989
0231 - 184989
and more