首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2EE开发 >

急问Pattern和Matcher无法匹配换行吗?该怎么解决

2012-03-26 
急问Pattern和Matcher无法匹配换行吗?a hrefhttp://www.panguso.com/IMG srchttp://www.panguso.c

急问Pattern和Matcher无法匹配换行吗?
<a href="http://www.panguso.com/">
  <IMG src="http://www.panguso.com/1095/20111025/9bfff4d5-b7d9-40ca-83e4-f407d48264c6.png" alt="盘古搜索" title="盘古搜索">
   
</a>
  
对上面这个字段,我怎么匹配不到呢?是因为有换行吗?
我是这么干的
  Pattern patternA = Pattern.compile("<a .*?</a>");
  Matcher matcherA = patternA.matcher(src);  
   
  while (matcherA.find()) {
  String strA = matcherA.group();  
  Log.i(TAG, strA);  
  } 

有没有解决办法?

[解决办法]
能就结贴散分吧

热点排行