日期:2014-05-18  浏览次数:20710 次

请教如何提取<a href=http://www.china.com/2003-10-28/113/314.html target=_blank>中href的值
对于以下的三种href格式

<a   href=http://andrei.gmxhome.de/jdepend4eclipse/links.html   target=_blank> 中href的值

<a   href= "http://andrei.gmxhome.de/jdepend4eclipse/1111111111.html "   target=_blank>
<a   href= 'http://andrei.gmxhome.de/jdepend4eclipse/22222222.html '   target=_blank>

提取出:
http://andrei.gmxhome.de/jdepend4eclipse/links.html  
http://andrei.gmxhome.de/jdepend4eclipse/1111111111.html
http://andrei.gmxhome.de/jdepend4eclipse/22222222.html '

请教正则表达式怎么写?



------解决方案--------------------
用正则表达式是可以的,也可以用Dom
------解决方案--------------------
http://([\\w-]+\\.)+[\\w-]+(/[\\w-\\./?%=]*)?
------解决方案--------------------
用正则表达式是对了

这里不能只使用http://([\\w-]+\\.)+[\\w-]+(/[\\w-\\./?%=]*)?模式
还的考虑href= "image/1.htm "模式


------解决方案--------------------
mark
------解决方案--------------------

正想进来支招说 正则表达式,同宿舍一牛人,对此驾轻就熟。

任何 href 逃不出他制造的“法眼”。。
------解决方案--------------------
.....
------解决方案--------------------
高深,看不明白~~~
------解决方案--------------------
为什么不用DOM4J?