Here is my problem: in a variable that is text and contains commas, I try to delete only the commas located between two strings (in fact [ and ]).
[
]
You can use an expression like this to match them (if the brackets are balanced):
,(?=[^][]*\])
Used something like:
re.sub(r",(?=[^][]*\])", "", str)