码迷,mamicode.com
首页 > 编程语言 > 详细

网页Email抓取 java

时间:2015-01-23 00:34:23      阅读:225      评论:0      收藏:0      [点我收藏+]

标签:

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;


public class EmailSpilder {
    public static void main(String[] args) {
        try {
            BufferedReader re = new BufferedReader(new FileReader("D:\\大家留下email吧。。.htm"));
            String line = null;
            while((line = re.readLine())!=null){
                parse(line);
            }
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        
    }

    private static void parse(String readLine) {
        Pattern p = Pattern.compile("[\\w[.-]]+@[\\w[.-]]+\\.[\\w]+");
        Matcher m = p.matcher(readLine);
        while(m.find()){
            System.out.println(m.group());
        }
    }
}

 

网页Email抓取 java

标签:

原文地址:http://www.cnblogs.com/lakelise/p/4243014.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!