I seem to be having issues. I have a query string that has values that can contain single quotes. This will break the query string. So I was trying to do a replace to change
If you want to use it in JavaScript then you can use
str.replace("SP","\\SP");
But in Java
str.replaceAll("SP","\\SP");
will work perfectly.
SP: special character
Otherwise you can use Apache's EscapeUtil. It will solve your problem.