I have a string of the form:
" { \"Name1\":\"Value1\",\"Name2\":\"Value2\",\"Name3\":\"Value3\" } "
except with about 50 such pairs. I need to Search for some 10 names out of these 50 (I don't know their position, I only know the name) and replace it's corresponding Value with a string "newValue".
How do I go about this? I though of finding the location of Name, let us say it was from char 30-40, then use a regex of type ( \" .* \"
) from char 40 onwards to find the complete size of Value. , Then I can replace. Sadly the some of the values themselves contain strings of type ( \" ...... \"
) and anything else (including commas, backslashes, quotes etc..)so I don't think this will work. Any suggestions?