0
Python Regex
Phone Number Validation Fails on test case 4 only couldnât figure out. import re #your code goes here number = input('') pattern = r'[981]\d{7}' for num in number: matches = re.match(pattern, number) if matches: print('Valid') else: print('Invalid')
2 Answers
+ 1
try starting the pattern with the starting character symbol: ^ and ending with the end character symbol: $
r"^[981]\d{7}quot;
0
you must check for the length too