obtenha apenas o valor src
Eu tenho no banco de dados um campo que sempre terá uma tag. e também muito texto ..
Por exemplo:
Hey there.. whats up?
<img src="http://cdn.theatlantic.com/static/infocus/ngpc112812/s_n01_nursingm.jpg" alt="" />
.. and this is my photo!..
Eu preciso obter apenas o que entre o
src
Eu tentei :
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;
}
Mas eu tenho um erro de análise:
Detalhes da Exceção: System.ArgumentException: parsing "\ ([^]] +) \ />" - Referência ao nome do grupo indefinido img.
não sei se meu código é o caminho certo ...