human
Regex, find pattern only in middle of string
assistant
Here is some code to regex, find "n"s only in the middle of string `s`

re.findall('n(?<=[^n]n)n+(?=[^n])(?i)', s)

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.