fork download
  1. import re
  2. p = re.compile(r'(?<!^)(?<!n)((n)\2{2,})(?!$)(?!n)', re.IGNORECASE)
  3. s = "nnnABCnnnnDEFnnnnnGHInnnnnn"
  4. print(p.findall(s))
Success #stdin #stdout 0.02s 9016KB
stdin
Standard input is empty
stdout
[('nnnn', 'n'), ('nnnnn', 'n')]