java - Input Sanitizing to not break JSON syntax -


so, in nutshell i'm trying create regex can use in java program submit json object php server.

mystring.replaceall(myregexstring,"");

my question absolutely no regex , add onto need escape characters stored in string, , escape characters inside regex. lordy.

what came this:

string myregexstring = "[\"',{}[]:;]"

the first backslash escape outer quotes " in there. , struck me {} , [] regex commands. escape well? like:

string myregexstring = "[\"',\{\}\[\]:;]"

thanks in advance. in case wasnt clear examples above characters care @ moment in time is: " { } [ ] , , ; : ' general sqlinj protection.

update:

this final regex: [\\q\"',{}[\]:;\\e] else curious. amit!

try like

string myregexstring = "[\\q\"',{}[]:;\\e]"; 

now characters between \q , \e treated normal characters.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -