0
Regular expression
Please can someone help me with this; import re #your code goes here user_input = input() pattern = re.compile(r'[189]\d{7}') if pattern.match(user_input): print('Valid') else: print('Invalid') I keep failing the 3rd test case( and I don't know why).
2 Respuestas
+ 3
You need start "^" and end anchors "quot; (specially end for match), so it won't match strings like "81234567egg"
+ 1
CarrieForle
Thanks alot. My mind was totally off that 👍