黑马程序员技术交流社区
标题:
获取一个网页上的邮箱地址
[打印本页]
作者:
千山万水
时间:
2015-8-25 23:20
标题:
获取一个网页上的邮箱地址
需求:
获取一个网页上的邮箱地址
*/
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
import java.net.URL;
public classTest{
public static void main(String...args)throws Exception{
URL url =new URL("http://127.0.0.1:8080/");
BufferedReader bufin =
new BufferedReader(new InputStreamReader(url.openStream()));
String line =null;
String regex = "[1-9a-zA-z]\\w+@\\w+(\\.\\w+)+";
Pattern p =Pattern.compile(regex);
while((line=bufin.readLine())!=null){
Matcher m = p.matcher(line);
while(m.find()){
System.out.println(m.group());
}
}
}
}
复制代码
作者:
pengbeilin
时间:
2015-8-25 23:45
用了文本框的界面,然后在文本框中输入网站就可以把网站页面中的邮箱扣出来存入自己设置的文档中。有兴趣的话可以写一下
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2