Does anyone know how to replace text in a string (Python) that is only between ( ) ? Example:
this is a string (replace the n here)
output:
this is a string (replace the p here) (turn the n into a p)
Conversation
Replying to
re.sub(r"(\([^)]*)( n )([^)]*\))", r"\1 p \3", "this is a string (replace the n here)")
1
6

