61,653
社区成员




string s = ",比如http://style.sina.com.cn/industry/2012-10-08/1147106801.shtml 这种";
s = Regex.Match(s, @"[a-zA-z]+://[^\s]*").ToString();
System.Diagnostics.Debug.Print(s);
MessageBox.Show(s);
// 输出
// http://style.sina.com.cn/industry/2012-10-08/1147106801.shtml
string s = "http://style.t.sina.com.cn/index.shtml http://roll.style.sina.com.cn/fas/jewelry/index.shtml http://roll.style.sina.com.cn/time/guide/index.shtml http://roll.style.sina.com.cn/tas/cigar/index.shtml http://roll.style.sina.com.cn/tas/club/index.shtml http://roll.style.sina.com.cn/lei/hotels/index.shtml http://roll.style.sina.com.cn/lei/cars/index.shtml http://roll.style.sina.com.cn/lei/yachting/index.shtml http://roll.style.sina.com.cn/des/architecture/index.shtml http://roll.style.sina.com.cn/industry/index.shtml http://style.sina.com.cn/industry/2012-10-08/1147106801.shtml";
Regex re = new Regex(@"[a-zA-z]+://[^\s]*");
MatchCollection mc = re.Matches(s);
string t = string.Empty;
foreach (Match m in mc)
{
if (Regex.IsMatch(m.ToString(), @"[a-zA-z]+://[\s\S]*?/[0-9]+.shtml"))
{
System.Diagnostics.Debug.Print(m.ToString());
}
}
//输出 http://style.sina.com.cn/industry/2012-10-08/1147106801.shtml