Spaces:
Sleeping
Sleeping
File size: 357 Bytes
74bb5fe |
1 2 3 4 5 6 7 8 9 10 11 12 |
import re
def extract_phone(text: str) -> str | None:
if not text:
return None
m = re.search(r"(\+?\d[\d\-\s]{8,}\d)", text)
return m.group(1).replace(" ", "") if m else None
def looks_valid(phone: str | None) -> bool:
if not phone: return False
digits = "".join(ch for ch in phone if ch.isdigit())
return len(digits) >= 10 |