110,499
社区成员
发帖
与我相关
我的任务
分享
string html = File.ReadAllText(@"C:\1.txt",Encoding.GetEncoding("GB2312")); ;
string pattern = @"(?is)<div\s*class=""content"">[\s\S]*?<img[^>]*?src=""(?<src>[^""]*?)""[^>]*?alt=""(?<alt>[^""]*?)""[^>]*?/>[\s\S]*?<p\s*class=""bio "">(?<pcontent>.*?)</p>
";
Regex reg = new Regex(pattern);
Console.WriteLine(reg.Match(html).Groups["src"].Value);
Console.WriteLine(reg.Match(html).Groups["alt"].Value);
Console.WriteLine(reg.Match(html).Groups["pcontent"].Value);