Board logo

标题: 抓取邮件 [打印本页]

作者: qingqing3721    时间: 2011-8-18 00:00     标题: 抓取邮件

import java.io.*;import java.util.regex.*;
/*** 抓取邮件* * @author JRunner* * 2009-10-30* * Email:JRunner@126*/public class EmailFetch {
/** * @param 入口 */public static void main(String[] args) {try {BufferedReader br = new BufferedReader(new FileReader("D:\\Java.mht"));String row = "";//比拟是是最后一行while ((row = br.readLine()) != null)parse(row);System.out.println("success...");
} catch (FileNotFoundException e) {e.printStackTrace();} catch (IOException e) {e.printStackTrace();}
}
// 读取并打印private static void parse(String row) {Pattern p = Patternpile("([\\w[.-]]+)@[\\w[.-]]+\\.[\\w]+");Matcher m = p.ifsong旗舰店matcher(row);while (m.find()) {System.out.println(m.group(1));}}
}




欢迎光临 编程开发论坛 (http://bbs.lihuasoft.net/) Powered by Discuz! 6.0.0