I have a Dictionary<string , string> dict and a string script.
I want to replace each occurrence of key in script with corresponding value from the Dictionary in such a way that only tokens which are same as key are replaced.
Example
Dictionary dict has the following entries :
"name" : "John"
"age" : "34"
and
string script = " The name and the fathersname and age and age_of_father "
Output after Replace should be :
script = " The John and the fathersname and 34 and the age_of_father "
I have tried using string.Replace() but it doesn't work. How can I accomplish this using Regex.Replace() and concept of Lookahead ?