title: Need to replace href of anchor tags in a string
body: <pre><code>string content=" 
          &lt;br /&gt;&lt;br /&gt;&lt;a href="need to replace this url"&gt;Cooking School&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.sdlm.com"&gt;Feed your senses&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.sdl.com"&gt;Take your cooking skills to the next level. Find a cooking school near you!&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http:google.com"&gt;&lt;img src="http://www.sdlm1.com/autd3umrl_u_t.jpg" /&gt;&lt;/a&gt;
       "
  </code></pre>
  
  <p>I need to replace all anchor tags href value with different urls
  I used the following function but its getting error</p>
  
  <pre><code> public List&lt;string&gt; GetLinksFromHtml(string content)
          {
              string regex = @"&lt;(?&lt;Tag_Name&gt;(a)|img)\b[^&gt;]*?\b(?&lt;URL_Type&gt;(?(1)href|src))\s*=\s*(?:""(?&lt;URL&gt;(?:\\""|[^""])*)""|'(?&lt;URL&gt;(?:\\'|[^'])*)'))";
              var matches = Regex.Matches(content, regex, RegexOptions.IgnoreCase | RegexOptions.Singleline);
              var links = new List&lt;string&gt;();
  
              foreach (Match item in matches)
              {
                  string link = item.Groups[1].Value;
                  links.Add(link);
              }
  
              return links;
          }
  </code></pre>
  
  <p>Thanks for any help</p>