# your code goes hereimport re s = 'ABCDEFGHIJKLMNOCDEFGZYPE' print re.findall(r".+?(?<=CDE)(?=FG)|.+", s)
Standard input is empty
['ABCDE', 'FGHIJKLMNOCDE', 'FGZYPE']
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!