Skip to content

Commit

Permalink
Regex and Parsing!
Browse files Browse the repository at this point in the history
  • Loading branch information
snehalmastud authored Feb 23, 2020
1 parent 02ee520 commit e034916
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Regex and Parsing/Validating UID/Solution.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import re

for i in range(int(raw_input())):
N = raw_input().strip()
if N.isalnum() and len(N) == 10:
if bool(re.search(r'(.*[A-Z]){2,}',N)) and bool(re.search(r'(.*[0-9]){3,}',N)):
if re.search(r'.*(.).*\1+.*',N):
print 'Invalid'
else:
print 'Valid'
else:
print 'Invalid'
else:
print 'Invalid'

0 comments on commit e034916

Please sign in to comment.