Hi guys,
this is the first time for me to post something, i'm really a big fan of the site and so far every time i get stuck in something at uni i come to here. so thanks for helping me survive so far.
anywho, i'm here because i need something, well i would've said thanks either way <<< lair
i'm writing a python parser that could find any time format in a given source.
i thought i'm doing good until i realized that the search function in re only gets the first occurrence of the pattern givin to it. so i used find all with the same pattern and this what happened:
>>> import re
>>> hourRE = re.compile(r"[0-2]?\d(:[0-5]\d(-[0-2]?\d:[0-5]\d|[ap]m)?|[ap]m)", re.IGNORECASE)
>>> temp = hourRE.search("10am , 10:00 , 3pm")
>>> temp.group()
'10am'
>>> temp = hourRE.findall("10am , 10:00 , 3pm")
>>> temp
[('am', ''), (':00', ''), ('pm', '')]
could anyone tell why does this happen and what does it mean?