>>> re.findall('d+|$', 'aa33bbb44')[0] '33' >>> re.findall('d+|$', 'aazzzbbb')[0] '' >>> re.findall('d+|$', '')[0] ''