title: Replace a text from the key value pairs
body: <p>I'm trying to replace a text from the key value pairs of a dictionary. Here is the powershell script I'm working on,</p>
  
  <pre><code>foreach ($string in $templatestrings) {
  
  
                 if($Dictionary.ContainsKey($string))
                  {
                      $Dictionary.Keys | % { $templatecontent = $templatecontent -replace "{{$string}}", ($Dictionary[$_]) }
                   }  
  
      }
   $templatecontent | set-content $destinationfilename
  
  }
  </code></pre>
  
  <p>Basically If the text value matches with dictionary key, then we will replace the text with dictionary value. Seems the replacing part is not working as expected. I want to replace text value with dictionary value. <code>I'm storing the text values in $templatecontent variable.</code> Can someone please tell me the correct way to replace these text values. </p>