/// <summary>
/// 获得字符串中开始和结束字符串中间得值列表
/// </summary>
/// <param name="styleContent">样式内容</param>
/// <returns></returns>
private MatchCollection GetValueList(string str, string s, string e)
{
return Regex.Matches(str, "(?<=(" + s + "))[.\\s\\S]*?(?=(" + e + "))", RegexOptions.IgnoreCase);
}

用法

            MatchCollection HrefList = this.GetValueList(listHtml, ListHrefBegin, ListHrefEnd);
foreach (Match match in HrefList)//循环获取
{
if (match.Value.StartsWith("/"))
list += "http://" + uri.Host + match.Value + "\r\n";
else
list += match.Value + "\r\n";
}

  

05-08 15:38