-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPracRE.py
More file actions
38 lines (34 loc) · 749 Bytes
/
PracRE.py
File metadata and controls
38 lines (34 loc) · 749 Bytes
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
# __author__ = 'CL'
#
# import re
#
# pattern = re.compile(r'Hello')
#
# result1 = re.match(pattern, 'Hello')
# result2 = re.match(pattern, 'Helloo CL!')
# result3 = re.match(pattern, 'Helo CL!')
# result4 = re.match(pattern, 'Hello CL!')
#
# if result1:
# print(result1.group())
# else:
# print("1 failed matching!")
#
# if result2:
# print(result2.group())
# else:
# print("2 failed matching!")
#
# if result3:
# print(result3.group())
# else:
# print("3 failed matching!")
#
# if result4:
# print(result4.group())
# else:
# print("4 failed matching!")
#################################################################
import re
pattern = re.compile(r'\d+')
print(re.findall(pattern, 'one1two2three33four456'))