import rep = re.compile(r'-(?!(?:aa|bb)-)([^-]+)(?=-)')s = "-a-bc-aa-def-bb-ghij-"print(p.findall(s))
Standard input is empty
['a', 'bc', 'def', 'ghij']
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!