使用正则表达式抓取网页中的email地址
来源:互联网 发布:vs2015能开发php吗 编辑:程序博客网 时间:2024/05/16 13:38
import java.io.BufferedReader;import java.io.FileNotFoundException;import java.io.FileReader;import java.io.IOException;import java.util.regex.Matcher;import java.util.regex.Pattern;/* * 根据抓取的网页,获取其中包含的Email地址 * 主要是正则表达式应用 * */public class EmailSpider {public static void main(String[] args) {String filePath = "E:\\email.html";getEmail(filePath);}private static void getEmail(String filePath) {BufferedReader br = null;Pattern p = null;Matcher m = null;//构建邮件的正则表达式p = Pattern.compile("[\\w[.-]]+@[\\w[.-]]+\\.[\\w]+");try {br = new BufferedReader(new FileReader(filePath));String line = "";while((line = br.readLine()) != null) {m = p.matcher(line);if(m.find()) {System.out.println(m.group());}}} catch (FileNotFoundException e) {e.printStackTrace();} catch (IOException e) {e.printStackTrace();} finally {try {if(br != null) {br.close();br = null;}} catch (IOException e) {e.printStackTrace();}}}}
1 0
- 使用正则表达式抓取网页中的email地址
- java正则表达式的使用1 通过正则表达式抓取网页中的email
- 正则表达式--抓取email地址
- Java正则表达式(一)、抓取网页email地址实例
- Java正则表达式,抓取网页email地址实例
- JAVA语言用正则表达式抓取网页中的email
- 利用正则表达式抓取Email地址
- 利用正则表达式揪出网页中的email地址
- 抓取本地网页中的email地址
- java 正则 抓取文件中的email地址
- java正则表达式匹配网页email(email抓取)
- 抓取网页文件中的email地址的简易java程序
- 应用——抓取网页中的Email地址
- 正则表达式抓取网页中的邮箱地址
- 正则表达式验证Email地址
- 利用正则表达式提取html中的的Email地址
- 输入一个Email地址,然后使用正则表达式验证该Email地址是否正确。
- 利用python正则表达式抓取网页中的图片到本地
- 专属个人的聊天机器人的实现——图灵机器人
- Codeforces Round #260 (Div. 1)——Civilization
- linux查看文件和目录大小(du)
- 关于cocos2dx导入安卓项目至eclipse的诸多问题
- 编写手机页面的相关注意事项 杂记
- 使用正则表达式抓取网页中的email地址
- android 自定义圆形imageview控件
- pthread_cleanup_push 问题-转载
- bat中的if else用法
- sicily 1034之思路清晰
- [转载]最好的Python IDE:Eclipse + pydev
- 动态规划示例三
- EXTJS4 图表
- js查询数组中是否存在某个值