采集系统万能正则表达式
2007-11-30 13:54
204 查看
由于经常要写一些采集的程序,下面的三个函数是采集中的很常用的函数。姑且叫采集系统万能正则表达式吧。全部源码见
http://www.softbk.com/news.asp?id=3564
欢迎一起交流
//获取页面的html源码
public string GetHtmlSource(string Url, string charset)
public string SniffwebCode(string code, string wordsBegin, string wordsEnd)
public ArrayList SniffwebCodeReturnList(string code, string wordsBegin, string wordsEnd)
ArrayList urlList = new ArrayList();
//string NewsTitle = "";
Regex regex1 = new Regex("" + wordsBegin + @"(?<title>[\s\S]+?)" + wordsEnd + "", RegexOptions.Compiled | RegexOptions.IgnoreCase);
for (Match match1 = regex1.Match(code); match1.Success; match1 = match1.NextMatch())
urlList.Add(match1.Groups["title"].ToString());
}
return urlList;
}
http://www.softbk.com/news.asp?id=3564
欢迎一起交流
//获取页面的html源码
public string GetHtmlSource(string Url, string charset)
public string SniffwebCode(string code, string wordsBegin, string wordsEnd)
public ArrayList SniffwebCodeReturnList(string code, string wordsBegin, string wordsEnd)
ArrayList urlList = new ArrayList();
//string NewsTitle = "";
Regex regex1 = new Regex("" + wordsBegin + @"(?<title>[\s\S]+?)" + wordsEnd + "", RegexOptions.Compiled | RegexOptions.IgnoreCase);
for (Match match1 = regex1.Match(code); match1.Success; match1 = match1.NextMatch())
urlList.Add(match1.Groups["title"].ToString());
}
return urlList;
}
相关文章推荐
- ASP.NET采集系统万能正则表达式
- ASP.NET采集系统万能正则表达式
- ASP.NET采集系统万能正则表达式
- 织梦dedecms正则表达式采集过滤标签列表万能
- 信息采集系统之正则表达式
- 哪些自己曾经害怕的正则表达式以及一个万能的校验
- 正则表达式符号系统
- 网页采集时,常用的几种正则表达式
- 解析php利用正则表达式解决采集内容排版的问题
- javascript类型系统_正则表达式RegExp类型详解
- 【转 】网站采集 正则表达式
- 3、java设置Linux系统时间之 正则表达式解析时间 及总结
- 网页采集时,常用的几种正则表达式
- linux基础(二)系统结构、文件管理、正则表达式
- 作业电影评分系统 HIVE实战 正则表达式(限于string)解决了HIVE 源文件多个分隔符的问题
- 如何使用正则表达式进行QQ校友的数据采集
- 解析php利用正则表达式解决采集内容排版的问题
- Python网络数据采集——正则表达式
- 正则表达式系统教程------(转)
- linux grep命令 1.作用 Linux系统中grep命令是一种强大的文本搜索工具,它能使用正则表达式搜索文本,并把匹 配的行打印出来。grep全称是Global Regular Express