日期:2014-05-20  浏览次数:20667 次

求一个找出网页源代码中所有网址的正则表达式
如:从
<a   href= "http://classad.163.com/ "> 分类 </a>   <a   href= "http://114.163.com/ "> 黄页 </a>  
中得到http://classad.163.com和http://114.163.com
其中网址是可变的有可能是形如
http://community.csdn.net/Expert/PostNew.asp?room=5401
是在JAVA里面用的
感谢~~~~~~



------解决方案--------------------
Pattern pattern = Pattern.compile( " <a\\s+href\\s*=\\s*[\ "| ']?(.*?)[ '|\ "|> ] ", Pattern.CASE_INSENSITIVE);
Matcher m = pattern.matcher(pageContents);//pageContents为网页源码