请教问题:数据采集用match函数,如何从指定位置开始?

wuhuanghao 2014-10-19 12:58:01

MatchCollection matchs = Regex.Matches(webpage, singleReg, options);
int count = matchs.Count;
if (count > 0)
{
foreach (Match match in matchs)
{
//str 是一个列表:行1,行2,行3,行4,行5.................
string str = match.Groups["x"].Value;
//程序停止的时候,我记录了最后读取到这个str的第3行。
//程序再次执行的时候,如何指定从这个str的第4行开始读取?
}
}
...全文
166 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
threenewbee 2014-10-19
  • 打赏
  • 举报
回复
之前看错了,这个 foreach (Match match in matchs.Cast<Match>().Skip(n - 1))
wind_cloud2011 2014-10-19
  • 打赏
  • 举报
回复
string str = match.Groups["x"].Value;读取的数据放在数组里,再对数组进行控制。
threenewbee 2014-10-19
  • 打赏
  • 举报
回复
MatchCollection matchs = Regex.Matches(webpage.SubString(位置), singleReg, options);

110,539

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧