日期:2014-05-18 浏览次数:20523 次
Regex re = new Regex("(?<=^(http://.*))http://.*?(\\.jpg|\\.gif)", RegexOptions.None);
------解决方案--------------------
string tempStr = "http://www.csdn.net/dsalkdsalkkladlskdjklj http://1.1.com/jpg.jpgjpgasdasdasdasdshttp://3.2.com/gif.gifgiff2i3olk"; string pattern = @"(?i)http://\S+?\.(jpg|gif|jepg|png|bmp)"; foreach (Match m in Regex.Matches(tempStr, pattern)) { //循环输出 string value = m.Value; /* * http://1.1.com/jpg.jpg * http://3.2.com/gif.gif */ }