Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
Repeated match within another regular expression
a=['starts in 09h 05m 33s','ends in 00h 33m 12s'] import re r1 = re.compile(r'(starts|ends)') r2 = re.compile(r'(\d{2})[hms]') for s in a: m1 = r1.match(s) if m1: m2 = r2.findall(s) print(m1.group(0), m2[0], m2[1], m2[2])
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Python: Functions I : Functions with messages.
BinarySearchTree implementation in Python 3.5.2
Python_Hello_World
max/min fuction
hw11
Nearest Prime Number
ASICC art
HW L3
two-digits-puzzle
Guessing game
Please log in to post a comment.