首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网络技术 > 网络基础 >

从资料中获取email

2012-10-07 
从文件中获取email/**? * 从文件中获取email? * @throws Exception? */?public static void getMails() th

从文件中获取email

/**
? * 从文件中获取email
? * @throws Exception
? */
?public static void getMails() throws Exception {

??BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream("f:1.txt"), "UTF-8"));

??String line = null;

??String mailreg = "\\w+@\\w+(\\.\\w+)+";

??Pattern p = Pattern.compile(mailreg);

??while (null != (line = br.readLine())) {

???Matcher m = p.matcher(line);

???while (m.find()) {
????System.out.println(m.group());
???}
??}

?}

热点排行