0
Phone validator can take 8 digits starting only with 1,8,or 9
import re #your code goes here num=int(input()) pattern=r"[189][0-9]+" if re.match(pattern,"num"): print('Valid') else: print('Invalid')
3 Réponses
+ 1
delete quotes from num and add ^ $ for mark start end of pattern
0
Your regular expression pattern should reflect that there must be exactly 8 digits, so 7 after the first one.
r"[189][0-9]{7}"
0
Not all these are working I have tried it