- ubuntu12.04环境下使用kvm ioctl接口实现最简单的虚拟机
- Ubuntu 通过无线网络安装Ubuntu Server启动系统后连接无线网络的方法
- 在Ubuntu上搭建网桥的方法
- ubuntu 虚拟机上网方式及相关配置详解
CFSDN坚持开源创造价值,我们致力于搭建一个资源共享平台,让每一个IT人在这里找到属于你的精彩世界.
这篇CFSDN的博客文章java抓取网页或文件中的邮箱号码由作者收集整理,如果你对这篇文章有兴趣,记得点赞哟.
本文实例为大家分享了java抓取邮箱号码的具体代码,供大家参考,具体内容如下 。
java抓取文件中邮箱号码的具体代码 。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
package
reg;
import
java.io.BufferedReader;
import
java.io.FileNotFoundException;
import
java.io.FileReader;
import
java.io.IOException;
import
java.util.ArrayList;
import
java.util.List;
import
java.util.regex.Matcher;
import
java.util.regex.Pattern;
public
class
TestEmail {
public
static
void
main(String[] args) {
// TODO Auto-generated method stub
BufferedReader br=
null
;
try
{
br=
new
BufferedReader(
new
FileReader(
"D:/1.htm"
));
String str=
null
;
StringBuilder sb=
new
StringBuilder();
while
((str=br.readLine())!=
null
){
sb.append(str);
}
List es=getEmail(sb.toString());
for
(String e:es){
System.out.println(e);
}
}
catch
(FileNotFoundException e) {
// TODO: handle exception
e.printStackTrace();
}
catch
(IOException e) {
// TODO: handle exception
e.printStackTrace();
}
finally
{
try
{
if
(br!=
null
) br.close();
}
catch
(IOException e) {
// TODO: handle exception
e.printStackTrace();
}
}
}
public
static
List getEmail(String str){
List es=
new
ArrayList();
Pattern p=Pattern.compile(
"[\\w\\.-]*\\w+@[\\w\\.-]*\\w+\\.\\w{2,5}"
);
// Pattern p=Pattern.compile("[\\w[.-]]+@[\\w[.-]]+\\.[\\w]+");
Matcher m=p.matcher(str);
while
(m.find()){
es.add(m.group());
}
return
es;
}
}
|
java抓取网页中邮箱号码的具体代码 。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
package
reg;
import
java.io.BufferedReader;
import
java.io.InputStreamReader;
import
java.util.regex.Matcher;
import
java.util.regex.Pattern;
public
class
Testemail01
{
public
static
String getWebCon(String domain)
{
System.out.println(
"开始抓取邮件地址..("
+domain+
")"
);
StringBuffer sb=
new
StringBuffer();
try
{
java.net.URL url=
new
java.net.URL(domain);
BufferedReader in=
new
BufferedReader(
new
InputStreamReader(url.openStream()));
String line;
while
((line=in.readLine())!=
null
)
{
parse(line);
}
in.close();
}
catch
(Exception e)
{
sb.append(e.toString());
System.err.println(e);
}
return
sb.toString();
}
public
static
void
main(String[] args)
{
String s=Testemail01.getWebCon(
"http://tieba.baidu.com/p/2366935784"
);
}
private
static
void
parse(String line)
{
Pattern p=Pattern.compile(
"[\\w[.-]]+@[\\w[.-]]+\\.[\\w]+"
);
//邮箱的正则表达式
Matcher m=p.matcher(line);
while
(m.find())
{
System.out.println(m.group());
}
}
}
|
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持我.
最后此篇关于java抓取网页或文件中的邮箱号码的文章就讲到这里了,如果你想了解更多关于java抓取网页或文件中的邮箱号码的内容请搜索CFSDN的文章或继续浏览相关文章,希望大家以后支持我的博客! 。
这个问题与窗口处理或多个浏览器窗口的杂耍无关,而是关于在同一窗口中浏览 Web 应用程序的网页。我遇到这样的情况 1.我导航为屏幕 A->屏幕 x->屏幕 Y->屏幕 B 2.我需要捕获首次登录时屏幕
我有这个要求: The system will record the length of time the user displayed each page. 虽然在富客户端应用程序中微不足道,但我不
我在调试 JavaScript 网页时遇到问题。我遇到困难的地方是我标记 (...) 的地方。我收到未定义的错误。我是否将函数 countDown(start, Increment) 中的参数(即 s
需要一些帮助。我刚开始学习 HTML,今天一直在研究如何制作菜单,但在这样做时遇到了问题。 我似乎不知道如何在屏幕上居中显示菜单。 这就是我目前所拥有的; Home
我想通过单击按钮将小程序的任何参数发送到浏览器。 (HTML)。我知道按钮对象有一些方法,但不知道使用哪个。我怎样才能做到这一点?ps .: 我使用的是 jnlp 协议(protocol)。 类似于:
我应该使用Wikipedia的文章链接数据转储从组织的网站中提取代表性术语。 为此,我已经- 抓取并下载了该组织的网页。 (〜110,000) 创建了Wikipedia ID和术语/标题的字典。 (约
我的网页中包含 javascript 函数... function callFromAndroid(varName) { alert("call from android activated by
我想创建一个 Java 应用程序,允许用户导入网页并能够在程序中对其进行编辑。 导入网页将对其进行渲染,并且页面的组件(图像、文本等)将是可编辑或可拖动的,从而允许用户重新布局组件。 例如,用户可以加
当我们按下按钮时,我向 JFrame 添加了一个网页(网页在同一框架中打开)。效果很好。但我想向其中添加一个scrollPane,但是当我添加 JScrollPane jsp = new JScrol
我在使用 particles.js 时无法将图像居中。图像居中,但略微偏离中心。为什么要这样做,我如何才能将它居中? html particles.js demo CSS
我正在尝试在加载页面时播放音频,它应该非常简单但我无法完成。 问题是它没有播放,我尝试检查自动播放的状态(真/假),它说它在页面加载时播放,尽管它没有播放,还尝试制作一个将改变自动播放的功能状态为
我正在尝试显示用户从列表中选择的图像,但我在屏幕上看不到任何内容。 .container { position: relative; } .ce
这听起来有点奇怪,但我需要一些帮助,网页必须有一行必须包含三个部分,第一部分必须有 1 列的偏移量,并且部分之间的空间必须是 10px到目前为止,使用 Bootstrap 一切顺利。 现在第二行将有
这个问题在这里已经有了答案: Web and physical units (2 个答案) Div width in cm (inch) (6 个答案) 关闭 9 年前。
这个问题不太可能帮助任何 future 的访问者;它只与一个小的地理区域、一个特定的时间点或一个非常狭窄的情况有关,这些情况并不普遍适用于互联网的全局受众。为了帮助使这个问题更广泛地适用,visit
我想将我的 IPython 笔记本的宽度设置为 2500 像素,并且我希望它左对齐。我该怎么做? 我使用这段代码来应用我自己的 CSS: from IPython.core.display impor
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 7 年前。 Improve this q
我在 Word 中制作了一份文档,希望人们在其中添加自己的姓名以及他们的教学经验。我已将其保存为网页并发布到此处: http://epicforum.net/TS ...但操作部分实际上就是这样: h
这个问题在这里已经有了答案: Execute JS code after pressing the spacebar (5 个答案) 关闭 4 年前。
我正在开发一个只有两个页面的网站。 1.登录 2.首页 我正在使用 Angular 框架。 app.config(['$routeProvider', function ($routeProvider
我是一名优秀的程序员,十分优秀!