Hi first time regex user here. Just trying to figure out some regex but need some help.
I have a text file with the following items:
10:67 12:12 01:50 23:60 23:50
And I'm trying to get a list of the valid times so the output should be:
['12:12', '01:50', '23:50']
Here is my code:
import re
inFile = open("text.txt")
text = inFile.read()
pattern = re.findall('([01]\d|2[0-3]):[0-5]\d', text)
print pattern
My output is:
['12', '01', '23']
Any help figuring out whats wrong? Thanks!!!