import re p = re.compile(r'(\d{2}|(?!.*\d{2}))')r = p.search('wqddsel78ffgr')print r.groups()
Standard input is empty
('78',)
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!