I need to develop a function in javascript that escapes some chars and then returns the cleaner string.
for example I need to prefix all those chars:
^ * + ? [ ]
by \
from:
this is a [string] that ^ contains some ? chars
To
this is a \\[string\\] that \\^ contains some \\? chars
Best regards