title: Add escape "\" in front of special character for a string
body: <p>I have a simple SQL query where I check whether the query matches any of the fields I have. I'm using LIKE statement for this. One of my field can have special characters and so does the search query. So I'm looking for a solution where I need to an escape "\" in front of the special character.</p>
  
  <pre><code>query = "hello+Search}query"
  </code></pre>
  
  <p>I need the above to change to </p>
  
  <pre><code>query = "hello\+Search\}query"
  </code></pre>
  
  <p>Is there a simple way of doing this other than searching for each special character separately and adding the "\". Because if I don't have the escape character I will get the error message </p>
  
  <pre><code>java.util.regex.PatternSyntaxException: Dangling meta character '+' near index 0
  </code></pre>
  
  <p>Thanks in advance</p>