-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmatch2.py
More file actions
31 lines (26 loc) · 781 Bytes
/
match2.py
File metadata and controls
31 lines (26 loc) · 781 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
import re
content = 'Hello 1234567 World_This is a Regex Demo'
result = re.match('^Hello\s(\d+)\sWorld', content)
print(result)
print(result.group())
print(type(result.group()))
print(result.group().split(' '))
print(result.group().split(' ')[1])
print(result.span())
print(type(result.group().split(' ')))
#result = re.math("^Hello.*Demo$", content)
#print(result.group())
#print(result.span())
#print(result.group(1))
#print(result.group(2))
#print(result.group(0))
#print(result.group().split(' '))
#print(type(result.group().split(' ')))
#result = re.match('^Hello.*?(\d+).*Deom$')
#print(result.group())
#print(result.span())
#print(result.group(1))
#print(result.group(2))
#print(result.group(3))
#pirnt(result.group().split(' '))
#print(type(result.group().split(' ')))