https://www.cnblogs.com/zhangxiaoyong/p/6043283.html
foreach (var x in Table.Data.XXX.Select(x => new { x.ID, x.Contents, x.ContentsHtml }).ToList())
{
string Contents = Regex.Replace(x.Contents, @"<p[^>]*>(?:\s| )*(.*?)</p>", "<p>$1</p>");
string ContentsHtml = Regex.Replace(x.ContentsHtml, @"<p[^>]*>(?:\s| )*(.*?)</p>", "<p>$1</p>");
Table.Data.<span style="font-family: Arial, Helvetica, sans-serif;">XXX</span><span style="font-family: Arial, Helvetica, sans-serif;">.Where(o => o.ID == x.ID).Update(new AJ.VO.Cms.ArtPO { Contents = Contents, ContentsHtml = ContentsHtml });</span>
}
string patten = @"http://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?";
Regex.Matches(GetHtml("http://www.diyigaokao.com/major/bklist.aspx"), patten, RegexOptions.IgnoreCase).Cast<Match>().ToList().ForEach(x =>
{
var info = new SpecialtyInstitutionPO { Caption = x.Groups[1].Value, SubjectType = eumSubjectType.Undergraduate };
Table.Data.xxx.Insert(info);//专业
Regex.Matches(x.Groups[2].Value, @"<h3>([^<]*)</h3>[\s\S]*?<ul\s+class=""cf"">([\s\S]*?)</ul>", RegexOptions.IgnoreCase).Cast<Match>().ToList().ForEach(y =>
{
// Console.WriteLine("C2:" + y.Groups[1].Value);//子专业
Regex.Matches(y.Groups[2].Value, @"<a[\s\S]*?href=""([^""]*)""[\s\S]*?>([^<]*)</a>", RegexOptions.IgnoreCase).Cast<Match>().ToList().ForEach(z =>
{
SpecialtyPO special = new SpecialtyPO();
special.Caption = z.Groups[2].Value;
special.SpecialtyInstitutionID = info.ID;
special.DivisionType = eumDivisionType.LiberalArts;
special.Domain = GetChineseSpell(z.Groups[2].Value).ToLower();
//Console.WriteLine("Detail:" + z.Groups[2].Value + " Link:" + z.Groups[1].Value);//子专业明细
Regex.Matches(GetHtml("http://www.diyigaokao.com" + z.Groups[1].Value), @"<li>([^<]*)<strong>专业代码:([^<]*)</strong>([^<]*)</li>", RegexOptions.IgnoreCase).Cast<Match>().ToList().ForEach(a =>
{
special.SpecialtyNo = a.Groups[3].Value;
});
Regex.Matches(GetHtml("http://www.diyigaokao.com" + z.Groups[1].Value), @"<div\s+class=""introduction""[^<>]*>[^<>]*<div\s+class=""ctn cf"">([\s\S]*?)</div>([^<]*)</div>", RegexOptions.IgnoreCase).Cast<Match>().ToList().ForEach(b =>
{
special.Contents = b.Groups[1].Value;
});
Table.Data.xxx.Insert(special);
});
});
});