I was looking around and found the re.match to validate a user's input on a phone number. I have the print function there to debug, and it keeps coming back as None type instead of True. Is there a formatting error that I am overlooking?
def validation():
flag = True
while flag:
phone = input('Enter your phone number (XXX-XXX-XXXX): ')
answer = re.match(r'^[0-9]{3}-[0-9]{3}-[0-9]}{4}$',phone)
print(answer)
Basically, I am trying to get the function to validate that the number is in the format XXX-XXX-XXXX and when it is then I can continue, but right now all I am focusing on is returning True on the re.match. The rest of the code I will do after.