Fill in the pattern in the following function to identify if astring is a valid phone number in US. A valid phone number in UScan be of any of the following formats, where x signifies adigit.
+1 (xxx) xxx-xxxx+1 (xxx)xxx-xxxx+1 xxx xxx xxxx+1 xxx-xxx-xxxx+1 xxx.xxx.xxxx+1 xxxxxxxxxx(xxx) xxx-xxxx(xxx)xxx-xxxxxxx xxx xxxxxxx-xxx-xxxxxxx.xxx.xxxxxxxxxxxxxx
import re
def isPhoneNumber(astring):
if re.match(“______________________”,astring):
return(“Valid phone number”)
else:
return(“Invalid phone number”)
Use regular expression pattern to summarize all thepossibilities to complete the code using python
Expert Answer
An answer will be send to you shortly. . . . .