随笔分类 - 正则表达式
摘要:我这边找了个小说网站: 基本套路: 第一步:获取小说每一章的url地址 第二步:获取章节url内容并使用正则表达式提取需要的内容 第三步:多线程封装,实现如下效果 最后测试。 代码: 内容获取封装: public class WebSpider { //<a href="/35/35971/1355
阅读全文
摘要:正则表达式基本用法: 测试代码: @Test public void test01() { String str = "adsfd##4324"; // 创建正则表达式对象 Pattern p = Pattern.compile("\\w+"); // 创建Matcher 对象 Matcher m
阅读全文