java爬虫程序进入死循环 我用java编辑了一段在网页里面爬邮箱地址的代码!可是不知道怎么回事一运行就进入死循环,而且爬到的邮箱都是网页中页面上的第一个邮箱地址,然后一直重复的显示这个地址,这是怎么回事啊?请高手帮我看看,小弟刚学java,不懂!谢谢大家!java爬虫程序出错 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这是我的代码,刚刚搞忘写了!sorry!import java.io.*;import java.util.regex.*;import java.net.*;public class regexText2 { /** * @param args */ public static void main(String[] args) throws Exception { // TODO Auto-generated method stub getMails_1(); } public static void getMails_1() throws Exception { URL url=new URL("http://jingyan.baidu.com/article/647f01157ea4ca7f2148a8ce.html"); URLConnection Conn=url.openConnection(); BufferedReader bufin=new BufferedReader(new InputStreamReader(Conn.getInputStream())); String line=null; String mailreg="\\w+@\\w+(\\.\\w+)+"; Pattern p=Pattern.compile(mailreg); while((line=bufin.readLine())!=null) { Matcher m=p.matcher(line); while(m.find(1)) { System.out.println(m.group()); } } }} import java.io.*;import java.util.regex.*;import java.net.*;public class regexText2 { /** * @param args */ public static void main(String[] args) throws Exception { // TODO Auto-generated method stub getMails_1(); } public static void getMails_1() throws Exception { URL url=new URL("http://jingyan.baidu.com/article/647f01157ea4ca7f2148a8ce.html"); URLConnection Conn=url.openConnection(); BufferedReader bufin=new BufferedReader(new InputStreamReader(Conn.getInputStream())); String line=null; String mailreg="\\w+@\\w+(\\.\\w+)+"; Pattern p=Pattern.compile(mailreg); while((line=bufin.readLine())!=null) { Matcher m=p.matcher(line); while(m.find(1)) { System.out.println(m.group()); } } }} 你好,改成这样就可以了while(m.find()){System.out.println(m.group);}---------- 运行java ----------[email protected][email protected][email protected][email protected][email protected][email protected][email protected][email protected][email protected][email protected][email protected][email protected][email protected][email protected][email protected][email protected]输出完成 (耗时 4 秒) - 正常终止 正则表达式求解 ByteBuffer中putInt(int value)方法的使用 java timeout 寻用dtree.js实现的无限树性菜单(有复选框勾选) 用JAVA做出来的窗体关不掉 Java编程实现FTP下载 求阶层代码 我有个怪问题。 有关Struts在Jbuilder下的运行,在线等待~~oicq:503071 一个正则表达式问题 java新手请前辈指点! 运行后打字不能发送
import java.io.*;
import java.util.regex.*;
import java.net.*;
public class regexText2 { /**
* @param args
*/
public static void main(String[] args) throws Exception
{
// TODO Auto-generated method stub
getMails_1(); }
public static void getMails_1() throws Exception
{
URL url=new URL("http://jingyan.baidu.com/article/647f01157ea4ca7f2148a8ce.html");
URLConnection Conn=url.openConnection();
BufferedReader bufin=new BufferedReader(new InputStreamReader(Conn.getInputStream()));
String line=null;
String mailreg="\\w+@\\w+(\\.\\w+)+";
Pattern p=Pattern.compile(mailreg);
while((line=bufin.readLine())!=null)
{
Matcher m=p.matcher(line);
while(m.find(1))
{
System.out.println(m.group());
}
}
}}
import java.util.regex.*;
import java.net.*;
public class regexText2 { /**
* @param args
*/
public static void main(String[] args) throws Exception
{
// TODO Auto-generated method stub
getMails_1(); }
public static void getMails_1() throws Exception
{
URL url=new URL("http://jingyan.baidu.com/article/647f01157ea4ca7f2148a8ce.html");
URLConnection Conn=url.openConnection();
BufferedReader bufin=new BufferedReader(new InputStreamReader(Conn.getInputStream()));
String line=null;
String mailreg="\\w+@\\w+(\\.\\w+)+";
Pattern p=Pattern.compile(mailreg);
while((line=bufin.readLine())!=null)
{
Matcher m=p.matcher(line);
while(m.find(1))
{
System.out.println(m.group());
}
}
}}
while(m.find()){System.out.println(m.group);}---------- 运行java ----------
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]输出完成 (耗时 4 秒) - 正常终止