在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
1 import java.io.BufferedReader; 2 import java.io.FileNotFoundException; 3 import java.io.FileReader; 4 import java.io.IOException; 5 import java.util.regex.Matcher; 6 import java.util.regex.Pattern; 7 8 9 public class EmailSpider { 10 11 /** 12 * @author zhw 13 * @param args 14 */ 15 public static void main(String[] args) { 16 17 try { 18 BufferedReader br = new BufferedReader(new FileReader("111.txt")); 19 String line = ""; 20 21 while((line = br.readLine())!=null){ 22 23 Parse(line); 24 25 } 26 27 br.close(); 28 } catch (FileNotFoundException e) { 29 // TODO Auto-generated catch block 30 e.printStackTrace(); 31 } catch (IOException e) { 32 // TODO Auto-generated catch block 33 e.printStackTrace(); 34 } 35 36 37 } 38 39 private static void Parse(String line) { 40 41 Pattern p = Pattern.compile("[\\w[.-]]+@[\\w[.-1]]+\\.[\\w]+"); 42 Matcher m = p.matcher(line); 43 while(m.find()) 44 System.out.println(m.group()); 45 46 47 } 48 49 } |
请发表评论