string regex = "<td class=\"art_tit\"><a href=\"(?<text>[^\"]*).*title=\"(?<title>[^\"]*\")";
MatchCollection mces = RegexUtil.GetGroupByRegex(html, regex);
if (mces == null || mces.Count <= 0) return;
//抓取网页的所有数据
DateTime startDate = new DateTime(2018, 4, 3);
foreach (Match m in mces)
{
DateTime date = TypeConvertUtil.StringToDateTime(m.Groups["date"].Value.Trim());
if (date <= startDate) continue;
SeekerResult result = new SeekerResult();
result.OrgCode = OrgCode;
result.Title = m.Groups["title"].Value.Trim();
抓取最近一周内的产品,代码如下:
//匹配数据
string regex = "<td width=\"70%\">\\s*<a href=\"(?<url>[^\"]*)\">(?<title>[^<]*)发行公告\\s*</a>\\s*</td>\\s*<td width=\"20%\" style=\"text-align:center;\">(?<date>\\d{4}.\\d{1,2}.\\d{1,2})";
MatchCollection mces = RegexUtil.GetGroupByRegex(html, regex);
if (mces == null || mces.Count <= 0) return;
DateTime startDate = DateTime.Now.AddDays(-7);
foreach (Match m in mces)
{
DateTime date = TypeConvertUtil.StringToDateTime(m.Groups["date"].Value.Trim());
if (date < startDate) continue;