package com.neil.regex; import java.io.BufferedReader; import java.io.FileReader; import java.util.regex.Matcher; import java.util.regex.Pattern; public class EmailFind { /** * 抓取网页中的电子邮件 * @param args */ public static void main(String[] args) { try { BufferedReader br=new BufferedReader(new FileReader("C:\\20.htm")); String lin=""; while((lin=br.readLine())!=null){ Pattern p=Pattern.compile("(\\w+(-\\w+)*)@(\\w+(-\\w+)*)(\\.(\\w+(-\\w+)*))+"); Matcher m=p.matcher(lin); while(m.find()){ System.out.println(m.group()); } } } catch (Exception e) { e.printStackTrace(); } } }


Shengyi188
2023年12月18日
暂无贡献等级
heqian LV17
2022年12月5日
是数据库 LV3
2021年3月31日
徐天堂 LV2
2021年2月23日
小学生波波 LV19
2020年6月8日
kong.yee LV40
2020年4月26日
吼吼大帝 LV2
2019年10月23日
魔鬼小玄 LV1
2019年10月13日
gtlishujie LV7
2019年4月17日
huangzeping LV2
2019年3月14日