110,530
社区成员
发帖
与我相关
我的任务
分享
public string RegxName = "<a.+?data-eid=\"qd_B58\".*>(.+)</a>";
public string RegxID = "\"(.*?)\"";
public void GetRegx(string sContent) {
string urlcontent = sContent;
try {
MatchCollection mc = Regex.Matches(urlcontent, RegxName,RegexOptions.Singleline);
foreach (Match match in mc) {
string GetStr = match.Value.ToString();
Regex regB = new Regex(RegxID);
MatchCollection mc1 = regB.Matches(GetStr);
foreach (Match mac in mc1) {
string idstr = mac.Value.ToString();
string iidstr = idstr;
}
}
}
catch(Exception ex) {
}
}
string RegxName = "<a href=\"//([^\"]*)\"[^>]*?data-eid=\"qd_B58\" data-bid=\"([^\"]*?)\">(.+?)</a>";
MatchCollection mc = Regex.Matches(content, RegxName);
foreach (Match match in mc)
{
string bookAddress = match.Groups[1].Value;
string bookID = match.Groups[2].Value;
string bookName = match.Groups[3].Value;
Console.WriteLine(bookAddress);
Console.WriteLine(bookID);
Console.WriteLine(bookName);
}