利用正则表达式从下载好的网页中筛选邮箱

import java.io.*;
import java.util.regex.*;

public class RegEmail{
    
    public static void main(String[] args){
        try{
            BufferedReader br = new BufferedReader(new FileReader("D:\\Java\\RegEmail\\刚下好的,要的留邮箱【麻花影视吧】_百度贴吧.html"));
            String line = "";
            while((line = br.readLine()) != null){
                Pattern p = Pattern.compile("[\\w[.-]]+@[\\w[.-]]+\\.\\w+");
                Matcher m = p.matcher(line);
                while(m.find()){
                    System.out.println(m.group());
                }
            }
        } catch(IOException e){
            e.printStackTrace();
        }
    }
    
}

 

posted @ 2020-04-02 14:42  yxfyg  阅读(201)  评论(0)    收藏  举报