日期:2014-05-17 浏览次数:20502 次
string text = "<p>今天天气不错哦</p><p><img style=\"float:none\" title=\"大众健身.jpg\" " +
"border=\"0\" hspace=\"0\" src=\"/xjk/Web/ueditor/ueditornet/net/upload/2012-06-18-15f3c36695-4802-45d9-bbf6-081684b67add.jpg\" />" +
"</p><p><img border=\"0\" hspace=\"0\" src=\"http://img.baidu.com/hi/jx2/j_0015.gif\" /></p>";
Regex regex = new Regex(@"(?is)<img\b[^>]*/>");
MatchCollection mc = regex.Matches(text);
List<string> list = new List<string>();
foreach (Match m in mc)
{
list.Add(m.Value);
}
Response.Write(list.First());