正则表达式(模拟网络爬虫、网络蜘蛛)
来源:互联网 发布:淘宝店家培训 编辑:程序博客网 时间:2024/06/05 01:27
网络爬虫(网络蜘蛛)
需求:获取邮箱
package com.cn.regex;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Author:Liu Zhiyong(QQ:1012421396)
* Version:Version_1
* Date:
* Desc:
网络爬虫(网络蜘蛛)
*/
public class Demo4 {
public static void main(String[] args) {
String str = "有事请联系:1012421396@qq.com 有事请联系:396@qq.com 有事请联系:1012421396@qq.com.cn 有事请联系:1012421396@qq.net 有事请联系:1012421396@qq.cn 有事请联系:1012421396@163.com";
String regex = "[a-zA-Z1-9]\\w{5,17}@[a-zA-Z0-9]{2,}(\\.(com|cn|net)){1,2}";
//把字符串的正则编译成正则对象
Pattern p = Pattern.compile(regex);
//使用正则对象产生匹配器对象
Matcher m = p.matcher(str);
while(m.find()){
System.out.println(m.group() );
}
}
}
0 0
- 正则表达式(模拟网络爬虫、网络蜘蛛)
- 正则表达式,模拟网络爬虫小例子
- 网络爬虫-正则表达式
- Python网络爬虫(3)正则表达式
- 网络蜘蛛爬虫原理
- 蜘蛛网络爬虫多线程
- 正则表达式练习,网络爬虫
- Python网络爬虫-正则表达式
- 正则表达式(2)——应用(匹配、切割、替换、查找)、模拟网络爬虫
- 网络爬虫(蜘蛛)Scrapy,Python安装!
- 网络爬虫(蜘蛛)Scrapy,Python安装!
- 网络爬虫(蜘蛛)Scrapy,Python安装!
- Web Spider 网络蜘蛛爬虫
- 网络爬虫(网络蜘蛛)之网页抓取
- 网络爬虫(网络蜘蛛)之网页抓取
- 网络爬虫、spider程序、网络蜘蛛
- 网络爬虫(网络蜘蛛)之网页抓取
- 网络爬虫(网络蜘蛛)之网页抓取
- xml的简单读写应用
- UNIX常用命令行指令(8)(变量)
- Tabu Search
- nginx开启pathinfo模式的两种方式
- java开发微信自动回复文本消息换行的问题。
- 正则表达式(模拟网络爬虫、网络蜘蛛)
- 触发器模板
- 2-006. 树的遍历
- 编译busybox
- 【折半枚举】
- C
- JAVA之工厂方法模式个人见解
- C++ 11 匿名函数体验
- LeetCode 28. Implement strStr()