Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a1e2c7a

Browse files
files
1 parent 9a07be2 commit a1e2c7a

File tree

4 files changed

+58
-13
lines changed

4 files changed

+58
-13
lines changed

‎13_Regex and Parsing/New Text Document.txt‎

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import re
2+
for i in range(int(input())):
3+
credit_no=input()
4+
if len(credit_no)==16 or 19:
5+
if "-" in credit_no:
6+
if re.findall(r"^[456]\d{3}-\d{4}-\d{4}-\d{4}$",credit_no):
7+
credit_no=credit_no.replace("-","")
8+
9+
if len(credit_no)==16:
10+
if re.findall(r"^[456]\d+$",credit_no) and len(re.findall(r"(.)1円{3,}",credit_no))==0:
11+
print("Valid")
12+
else:
13+
print("Invalid")
14+
else:
15+
print("Invalid")
16+
else:
17+
print("Invalid")
18+
19+
# IGNORE THIS PART
20+
21+
#import re
22+
#print(re.findall(r"^[456]\d{3}-\d{4}-\d{4}-\d{4}$","5122-2368-7954-3214"))
23+
#s="5122-24687954-3214"
24+
#if "-"in s:
25+
# sn=s.replace("-","",3)
26+
# print(sn)
27+
#print(re.findall(r"(.)1円{4}",sn))
28+
29+
#import re
30+
#a="aaabbjaajjjc"
31+
#print(re.findall(r"(.)1円{4}",a))
32+
#st="harshit"
33+
#st="gupta"
34+
#print(st)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
regex_integer_in_range = r"[1-9][\d]{5}"
2+
regex_alternating_repetitive_digit_pair = r"(\d)(?=\d1円)" #alternate
3+
import re
4+
P = input()
5+
print (bool(re.match(regex_integer_in_range, P))
6+
and len(re.findall(regex_alternating_repetitive_digit_pair, P)) < 2)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import re
2+
for i in range(int(input())):
3+
uids="".join(sorted(input()))
4+
if len(uids)==10:
5+
if len(re.findall(r"(.)1円*",uids))==10 and re.findall(r"[a-zA-Z0-9]",uids) and re.findall(r"[0-9]{3,}",uids) and re.findall(r"[A-Z]{2,}",uids):
6+
print("Valid")
7+
else:
8+
print("Invalid")
9+
else:
10+
print("Invalid")
11+
12+
13+
14+
# a="aaaabbjjjjc"
15+
# print(re.findall(r"(.)1円*",a))
16+
17+
# OUTPUT:
18+
# ['a', 'b', 'j', 'c']

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /