I'm trying to escape the characters -]\^$*.
each with a single backslash \
.
For example the string: ^stack.*/overflo\w$arr=1
will become:
\^stack\.\*/overflo\\w\$arr=1
What's the most efficient way to do that in Python?
re.escape
double escapes which isn't what I want:
'\\^stack\\.\\*\\/overflow\\$arr\\=1'
I need this to escape for something else (nginx).