Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- pattern = "^[456][0-9]{15}|^[456][0-9]{3}\-[0-9]{4}\-[0-9]{4}"
- for i in range(int(input())):
- stg = input()
- rstg = stg.replace("-","")
- falsePattern = r"([0-9])\1\1\1"
- print(re.findall(re.findall("[ _]",stg)))
- if re.search(pattern,stg) and not(re.search(falsePattern, rstg)) and not(re.search("[ _]",stg)):
- print('Valid')
- else:
- print('Invalid')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement