使用java正则表达式提取文本中所有邮箱地址
2014-09-14 22:23
686 查看
package net.oschina.tester; import java.io.File; import java.io.IOException; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.commons.io.FileUtils; /** * 提取邮件地址 * @author Winter Lau * @date 2010-6-14 下午04:56:15 */ public class EmailParser { private final static Pattern emailer = Pattern.compile("\\w+?@\\w+?.com"); /** * @param args * @throws IOException */ public static void main(String[] args) throws IOException { String txt = FileUtils.readFileToString(new File(args[0])); //System.out.println(txt); Matcher matchr = emailer.matcher(txt); while (matchr.find()) { String email = matchr.group(); System.out.println(email); } } }
转自:http://www.oschina.net/code/snippet_12_544
相关文章推荐
- 使用Java正则表达式来提取一篇文章中的邮箱账号
- java利用正则表达式获取一个网页中的所有邮箱地址
- Java代码:使用正则表达式匹配电子邮箱地址
- IOS使用正则表达式识别邮箱地址
- C#中使用正则表达式提取超链接地址
- C#中使用正则表达式提取超链接地址的集中方法
- C#中使用正则表达式提取超链接地址的集中方法
- Java中使用正则表达式获取网页中所有图片的路径
- java学习-- 使用正则表达式从网页上提取网站标题
- Java中使用正则表达式处理文本数据
- 用正则表达式提取网页中的邮箱地址
- java 使用正则表达式从网页上提取网站标题
- 用正则表达式提取网页中的邮箱地址
- 利用正则表达式统计代码中的(代码行数,注释行数,空白行数)利用正则表达式获取一个网页中所有的邮箱地址
- java 使用正则表达式从网页上提取网站标题
- 用正则表达式提取网页中的邮箱地址
- 在Java中使用正则表达式处理文本
- [Java][正则表达式]邮箱提取的小程序
- Java正则表达式判断邮箱地址数组,冒泡排序,String的方法
- Java中使用正则表达式获取网页中所有图片的路径