"Loris Bennett" <loris.benn...@fu-berlin.de> writes: > r...@zedat.fu-berlin.de (Stefan Ram) writes: > >> "Loris Bennett" <loris.benn...@fu-berlin.de> writes: >>>I thought that 'days' would default to '0'. >> >> It will get the value '0' if (?P<days>\d*) does >> /not/ participate in the match. >> >> In your case, it /does/ participate in the match, >> \d* matching the empty string. >> >> Try (?P<days>\d+)?. > > Ah, thanks. I was misunderstanding the meaning of 'participate'.
What I actually need is ((?P<days>\d+)(-?))?(?P<hours>\d\d):(?P<minutes>\d\d):(?P<seconds>\d\d) so that I can match both 99-11:22:33 and 11:22:33 and have 'days' be '0' in the later case. Thanks for pointing me in the right direction. Cheers, Loris -- This signature is currently under construction. -- https://mail.python.org/mailman/listinfo/python-list