黑马程序员_网页爬虫

来源:互联网 发布:淘宝怎样用图片搜索 编辑:程序博客网 时间:2024/05/15 06:08


---------------------- <a href="http://edu.csdn.net/heima" target="blank">android培训</a>、<a href="http://edu.csdn.net/heima" target="blank">java培训</a>、期待与您交流! ----------------------
import java.io.*;
import java.util.regex.*;


class practice33 
{
public static void main(String[] args) throws Exception
{
BufferedReader br=new BufferedReader(new FileReader("@.txt"));//传入要爬的信息
String s;
while((s=br.readLine())!=null)
{
Pattern p=Pattern.compile("\\w+@\\w+(.\\w+)+");
Matcher m=p.matcher(s);
while(m.find())
{
System.out.println(m.group());
}


}
}
}

---------------------- <a href="http://edu.csdn.net/heima" target="blank">android培训</a>、<a href="http://edu.csdn.net/heima" target="blank">java培训</a>、期待与您交流! ----------------------

原创粉丝点击