We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c3d4b9e commit 256af88Copy full SHA for 256af88
strings/phone_number_validator.py
@@ -0,0 +1,15 @@
1
+import re
2
+def validate_phone_number(phone: str) -> bool:
3
+ """
4
+ Validates a 10-digit Indian phone number.
5
+ >>> validate_phone_number("9876543210")
6
+ True
7
+ >>> validate_phone_number("1234567890")
8
+ False
9
+ >>> validate_phone_number("abcd123456")
10
11
+ >>> validate_phone_number("abcdedad")
12
13
14
+ pattern = r'^[6-9]\d{9}$'
15
+ return re.fullmatch(pattern, phone) is not None
0 commit comments