日期:2014-05-18  浏览次数:20357 次

求正则表达 5555我对这个不熟啊
第一种 <img   src=http://tbn0.google.com/images?q=tbn:csh_W3KPG_5n4M:   width=124   height=102>
第2种
http://www.cnbruce.com/blog/uploadfile/JPG/2006-10/5-86921-10.jpg

这两种的````谢谢大家了`555


------解决方案--------------------

第一种
string yourStr = .............;
MatchCollection mc = Regex.Matches(yourStr, @ " <img\s*src=([ ' " "]?)(? <img> [^ ' " "\s> ]*)\1[^> ]*> ", RegexOptions.IgnoreCase);
foreach (Match m in mc)
{
richTextBox2.Text += m.Groups[ "img "].Value + "\n ";
}

第二种什么意思,都是以http://开头,以.jpg结尾的吗
MatchCollection mc = Regex.Matches(yourStr, @ "http://\S*?\.jpg ", RegexOptions.IgnoreCase);
foreach (Match m in mc)
{
richTextBox2.Text += m.Value + "\n ";
}