title: Web.config partial search and replace
body: <p>I have App.config file in C# application.
  I want to partially replace all Keys matching ".UAT" with ".PROD" using xdt tranform.</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;    
  &lt;configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"&gt;
  
  &lt;appSettings&gt;
      &lt;add key="MyParam1.UAT" value="param1"/&gt;
      &lt;add key="MyParam2.UAT" value="param2"/&gt;
      &lt;add key="MyParam2.UAT" value="param3"/&gt;
    &lt;/appSettings&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>Here is the output I want</p>
  
  <pre><code>    &lt;?xml version="1.0"?&gt;    
  &lt;configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"&gt;
          &lt;appSettings&gt;
              &lt;add key="MyParam1.PROD" value="param1"/&gt;
              &lt;add key="MyParam2.PROD" value="param2"/&gt;
              &lt;add key="MyParam2.PROD" value="param3"/&gt;
            &lt;/appSettings&gt;
          &lt;/configuration&gt;
  </code></pre>
  
  <p>So far I've tried this using <a href="http://sedodream.com/2010/09/09/extendingxmlwebconfigconfigtransformation.aspx" rel="nofollow">CustomTransform</a> but it replaces only one element instead of all element. How can i get this to replace all elements</p>
  
  <pre><code>    &lt;?xml version="1.0"?&gt;    
  &lt;!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 --&gt;    
  &lt;configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"&gt;
  
  &lt;appSettings&gt;
      &lt;add xdt:Locator="Condition(contains(@key, '.UAT'))" xdt:Transform="AttributeRegexReplace(Attribute='key', Pattern='.UAT',Replacement='.PROD')" /&gt;
    &lt;/appSettings&gt;
  &lt;/configuration&gt;
  </code></pre>