GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Python/strings/indian_phone_validator.py at master · shitkoder/Python Expand file tree/ Copy pathindian_phone_validator.pyMore file actions 30 lines (26 loc) · 765 Bytes / Copy pathindian_phone_validator.pyFile metadata and controls30 lines (26 loc) · 765 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 import re def indian_phone_validator(phone: str) -> bool: """ Determine whether the string is a valid phone number or not :param phone: :return: Boolean >>> indian_phone_validator("+91123456789") False >>> indian_phone_validator("+919876543210") True >>> indian_phone_validator("01234567896") False >>> indian_phone_validator("919876543218") True >>> indian_phone_validator("+91-1234567899") False >>> indian_phone_validator("+91-9876543218") True """ pat = re.compile(r"^(\+91[\-\s]?)?[0]?(91)?[789]\d{9}$") match = re.search(pat, phone) if match: return match.string == phone return False if __name__ == "__main__": print(indian_phone_validator("+918827897895")) |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |