在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
/// <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"; }
|
请发表评论