import java.io.*;
import java.util.regex.*;
/**
* 抓取邮件
*
* @author JRunner
*
* 2009-10-30
*
* Email:jrunner@sina.com
*/
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 = Pattern.compile("([//w[.-]]+)@[//w[.-]]+//.[//w]+");
Matcher m = p.matcher(row);
while (m.find()) {
System.out.println(m.group(1));
}
}
}