title: Use C# to extract and replace href attribute value
body: <p>I am having following set of image map tags;</p>
  
  <pre><code>&lt;map name="planetmap"&gt;
    &lt;area shape="rect" coords="0,0,82,126" href="sun.htm" alt="Sun"&gt;
    &lt;area shape="circle" coords="90,58,3" href="mercur.htm" alt="Mercury"&gt;
    &lt;area shape="circle" coords="124,58,8" href="venus.htm" alt="Venus"&gt;
  &lt;/map&gt;
  </code></pre>
  
  <p>I need to extract href attribute and replace it with another url</p>
  
  <p>I am using following code but does not seems to work;</p>
  
  <pre><code>string input = @"&lt;area shape=""rect"" href=""http://www.google.com""&gt;";
              string pattern = "(href=([^ ]+))";
  Regex rgx = new Regex(pattern);
  string result2 = rgx.Replace(input, m =&gt; m.Groups[1].Value.Replace(result,"test.com"));
  </code></pre>
  
  <p>Could someone please help me.</p>
  
  <p>Thanks</p>