import java.io.*;
import java.net.*;
import java.util.regex.*;
public class YouXiangHuoQu {
public static void main(String[] args) throws Exception {
getMail();
}
public static void getMail() throws Exception{
URL url=new URL("http://www.byjth.com");//网页地址
URLConnection conn=url.openConnection();
BufferedReader bufin=new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line=null;
String mailreg="\\w+@\\w+(\\.\\w+)+";//正则匹配
Pattern p=Pattern.compile(mailreg);
while((line=bufin.readLine()) != null){
Matcher m=p.matcher(line);
while(m.find()){
System.out.print(m.group()+"\r\n");
}
}
}
}
java网络爬虫之邮箱采集器源码分享
http://www.byjth.com/thread-2282-1-1.html
(出处: 天黑社区)
本文出自 “闭眼就天黑” 博客,请务必保留此出处http://byjth.blog.51cto.com/4127898/1357846