Müssen Sie href von Anker-Tags in einer Zeichenfolge ersetzen

string content=" 
        <br /><br /><a href="need to replace this url">Cooking School</a><br /><br /><a href="http://www.sdlm.com">Feed your senses</a><br /><br /><a href="http://www.sdl.com">Take your cooking skills to the next level. Find a cooking school near you!</a><br /><br /><a href="http:google.com"><img src="http://www.sdlm1.com/autd3umrl_u_t.jpg" /></a>
     "

Ich muss alle Ankertags href value durch andere URLs ersetzen. Ich habe die folgende Funktion verwendet, aber es wird ein Fehler angezeigt

 public List<string> GetLinksFromHtml(string content)
        {
            string regex = @"<(?<Tag_Name>(a)|img)\b[^>]*?\b(?<URL_Type>(?(1)href|src))\s*=\s*(?:""(?<URL>(?:\\""|[^""])*)""|'(?<URL>(?:\\'|[^'])*)'))";
            var matches = Regex.Matches(content, regex, RegexOptions.IgnoreCase | RegexOptions.Singleline);
            var links = new List<string>();

            foreach (Match item in matches)
            {
                string link = item.Groups[1].Value;
                links.Add(link);
            }

            return links;
        }

Danke für jede Hilfe

Antworten auf die Frage(1)

Ihre Antwort auf die Frage