title: Input Sanitizing to not break JSON syntax
body: <p>So, in a nutshell I'm trying to create a regex that I can use in a java program that is about to submit a JSON object to my php server.</p>
  
  <p><code>myString.replaceAll(myRegexString,"");</code></p>
  
  <p>My question is that I am absolutely no good with regex and to add onto that I need to escape the characters properly as its stored in a string, and then also escape the characters properly inside the regex.   good lordy.</p>
  
  <p>What I came up with was this:</p>
  
  <p><code>String myRegexString = "[\"',{}[]:;]"</code></p>
  
  <p>The first backslash was to escape outer quotes to get a " in there.  And then it struck me that {} and [] are also regex commands.  Would I escape those as well?  Like:</p>
  
  <p><code>String myRegexString = "[\"',\{\}\[\]:;]"</code></p>
  
  <p>Thanks in advance.   In case it wasnt clear from examples above the only characters I really care about at this moment in time is:
  <code>" { } [ ] ,</code> and also <code>; : '</code> for general sqlinj protection.</p>
  
  <p>UPDATE:</p>
  
  <p>This is the final regex:
  <code>[\\Q\"',{}[\]:;\\E]</code> for anyone else curious.  Thanks Amit!</p>