-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogram62.py
More file actions
64 lines (53 loc) · 1.07 KB
/
program62.py
File metadata and controls
64 lines (53 loc) · 1.07 KB
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
#Meta Characters-----------
'''
. = dot any character
^& = ^ $
* = 0 or more
+ = 1 or more
? = o or 1
{and}
'''
import re
pettern = r"stud..nt"
if re.match(pettern,"studeint"):
print("Matched1")
import re
pettern = r"t.ach..r"
if re.match(pettern,"teachier"):
print("Matched2")
import re
pettern = r"^stud..t$"
if re.match(pettern,"student"):
print("Matched3")
import re
pettern = r"a*"
if re.match(pettern,"satudetnt"):
print("Matched4")
import re
pettern = r"a*"
if re.match(pettern,"arifa"):
print("Matched5")
import re
pettern = r"(ab)*"
if re.match(pettern,"arifb"):
print("Matched6")
import re
pettern = r"a*b"
if re.match(pettern,"abrifa"):
print("Matched7")
import re
pettern = r"a+"
if re.match(pettern,"arifa"):
print("Matched8")
import re
pettern = r"a+b"
if re.match(pettern,"abrifa"):
print("Matched9")
import re
pettern = r"Ar(-)?if"
if re.match(pettern,"Arif"):
print("Matched10")
import re
pettern = r"a{1,3}$"
if re.match(pettern,"aaa"):
print("Matched11")