110,500
社区成员
发帖
与我相关
我的任务
分享
string tempStr = File.ReadAllText(@"C:\Users\M\Desktop\Test.txt", Encoding.GetEncoding("GB2312"));
string pattern = @"<td[^>]*?class=(['""])row2\1[^>]*?>([^<]*?\.[^<]*)[\s\S]*?<td[^>]*?class=(['""])row2\3[^>]*?><a[^>]*?href=(['""])([^'""]*?)\4[^>]*?>";
Match m = Regex.Match(tempStr,pattern);
string fileName = m.Groups[2].Value;//非笔试类课程期末考核要求说明及评(软件工程).doc
string downloadLink = m.Groups[5].Value;//file_do.php?file_id=155909
string s = @"你的...";
Match match = Regex.Match(s, @"(?is)文件名称:.*?<td class=""row2"" width=""85%"">(?<文件名>.+?)</td>");
Console.WriteLine(match.Groups["文件名"].Value);
match = Regex.Match(s, @"(?is)下载地址:.*?<a href=""(?<下载地址>.+?)"">下载</a>");
Console.WriteLine(match.Groups["下载地址"].Value);