-
Notifications
You must be signed in to change notification settings - Fork 0
/
sets.py
80 lines (72 loc) · 1.57 KB
/
sets.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import re
txt = "The rain in the Spain"
x = re.findall("[arn]", txt) #check if the string has a, r, or n characters
print(x)
if x:
print("Yes, there is at least one match!")
else:
print("No match")
print()
import re
txt = "The rain in the Spain"
x = re.findall("[a-n]", txt) #check if the strings has any characters between a and n
print(x)
if x:
print("Yes, there is at least one match!")
else:
print("No match")
print()
import re
txt = "The rain in the Spain"
x = re.findall("[^arn]", txt)
print(x)
if x:
print("Yes, there is at least one match!")
else:
print("No match")
print()
import re
txt = "The rain in Spain"
x = re.findall("[0123]", txt)
print(x)
if x:
print("Yes, there is at least one match!")
else:
print("No match")
print()
import re
txt = "8 times before 11:45 AM"
x = re.findall("[0-9]", txt)
print(x)
if x:
print("Yes, there is at least one match!")
else:
print("No match")
print()
import re
txt = "8 times before 11:45 AM"
x = re.findall("[0-5][0-9]", txt) #check if the string has any two digits numbers from 00-59
print(x)
if x:
print("Yes, there is at least one match!")
else:
print("No match")
print()
import re
txt = "8 times before 11:45 AM"
x = re.findall("[a-zA-Z]", txt)
print(x)
if x:
print("Yes, there is at least one match!")
else:
print("No match")
print()
import re
txt = "8 times before 11:45 AM"
x = re.findall("[+]", txt) #check if the string has any + characters
print(x)
if x:
print("Yes, there is at least one match!")
else:
print("No match")
print()