import rep = re.compile(r'(?<!^)(?<!n)((n)\2{2,})(?!$)(?!n)', re.IGNORECASE)s = "nnnABCnnnnDEFnnnnnGHInnnnnn"print(p.findall(s))
Standard input is empty
[('nnnn', 'n'), ('nnnnn', 'n')]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!