My current code is quite messy as I have to manually write separate "replace" functions for each special character.
var str = ":''>";
str.replace("'","\\'").replace(">","\\>");
I am looking for a way to dynamically prepend a backslash to < > * ( ) and ? using regex.