0
What is wrong with my code. import re #your code goes heri x = (input()) pattern = r"(^1|8|9\d)(......)" if re.match (patte
Phone number validator+help+only one box failed
6 Answers
+ 4
What parameters are you trying to get your code to meet.
Please explain the challenge associated with your code
+ 1
import re
#your code goes heri
x = (input())
pattern = r"(^1|8|9\d)(......)"
if re.match (pattern , x):
print ("Valid")
else :
print ("Invalid")
#my full code
0
I am supposed to make a program that validates phone numbers. It should have 8 digits and start with either 1,8 or 9. It should output Valid if valid or Invalid if not valid.
0
Following the rules that you mentioned above it should look like ,
^[1|8|9]\d{7}
0
#Abhay
It did not work
0
#found the answer
import re
#your code goes heri
x = (input())
pattern = r"(^1|8|9\d)"
if re.match (pattern , x) and len (x)==8:
print ("Valid")
else :
print ("Invalid")
#Thanks for helping