bekomme nur den src Wert
Ich habe in der Datenbank ein Feld, das immer ein Tag haben wird. und auch viel text ..
Zum Beispiel:
Hey there.. whats up?
<img src="http://cdn.theatlantic.com/static/infocus/ngpc112812/s_n01_nursingm.jpg" alt="" />
.. and this is my photo!..
Ich brauche NUR was zwischen den
src
Ich habe es versucht :
public string LinkPicCorrect(string path)
{
//string input = "[img]http://imagesource.com[/img]";
string pattern = @"\<img>([^\]]+)\\/>";
string result = Regex.Replace(path, pattern, m =>
{
var url = m.Groups[1].Value;
// do something with url here
// return the replace value
return @"<img src=""" + url + @""" border=""0"" />";
},
RegexOptions.IgnoreCase);
result = "<img src='" + result + "'/>";
return result;
}
Aber ich habe einen Parsing-Fehler:
Ausnahmedetails: System.ArgumentException: Parsing "\ ([^]] +) \ />" - Verweis auf undefinierten Gruppennamen img.
Ich weiß aber nicht, ob mein Code der richtige Weg ist ...