Probably the easiest way is to name the two capturing groups:
reg = re.compile('(?P<city>[^\d]+)?(?P<zip>\d{5})?')
and then access the groupdict
:
>>> match = reg.match("binghamton ny 13905")
>>> match.groupdict()
{'city': 'binghamton ny ', 'zip': '13905'}
This gives you easy access to the two pieces of information by name, rather than index.