I'm trying to parse a csv file with times in the form of 6:30pm or 7am, or midnight. I've googled around and read the docs for regular expressions in the python docs but haven't been able to implement them successfully.
My first try to match them was:
re.findall(r'^d{1,2}(:d{1,2})?$', string)
But this didn't work. I have the parenthesis and the question mark there because sometimes there isn't always anything more than the hour. Also, I haven't even begun to think about how to match the am and pm. Any help is appreciated!