You are viewing a single comment's thread. Return to all comments →
My regex-only implementation:
from re import match p = '^(?=[456])(?!.*(.)-?\\1-?\\1-?\\1)(\\d{4}-?){3}\\d{4}$' for _ in range(int(input())): n = input() print('Valid' if match(p, n) else 'Invalid')
Seems like cookies are disabled on this browser, please enable them to open this website
Validating Credit Card Numbers
You are viewing a single comment's thread. Return to all comments →
My regex-only implementation: