SyntaxFix
Write A Post
Hire A Developer
Questions
I have used a trick to handle the apostrophe special character. When replacing ' for \' you need to place four backslashes before the apostrophe.
str.replaceAll("'","\\\\'");