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

java获取一段文字中的url地址并且在网页中以链接的方式显示

2012-09-23 
java获取一段文字中的url地址并且在网页中以链接的形式显示java获取一段文字中的url地址并且http://forum.

java获取一段文字中的url地址并且在网页中以链接的形式显示
java获取一段文字中的url地址并且http://forum.csdn.net/PointForum/Forum/PostTopic.aspx?forumID=467d91e3-dd10-480b-a322-71b65e66c736在网页中以链接http://forum.csdn.net/PointForum/Forum/PostTopic.aspx的形式显示发生的发生大幅飞洒放到http://forum.csdn.net/PointForum

在网页显示如下:

java获取一段文字中的url地址并且http://forum.csdn.net/PointForum/Forum/PostTopic.aspx?forumID=467d91e3-dd10-480b-a322-71b65e66c736在网页中以链接http://forum.csdn.net/PointForum/Forum/PostTopic.aspx的形式显示发生的发生大幅飞洒放到http://forum.csdn.net/PointForum



[解决办法]
lucene切词,好像没别的办法了
[解决办法]

Java code
    public static void main(String[] args) {        String s = "java获取一段文字中的url地址并且Http://forum.csdn.net/PointForum/Forum/PostTopic.aspx?forumID=467d91e3-dd10-480b-a322-71b65e66c736在网页中以链接http://forum.csdn.net/PointForum/Forum/PostTopic.aspx的形式显示发生的发生大幅飞洒放到http://forum.csdn.net/PointForum";        Matcher m = Pattern.compile("(?i)http://[^\u4e00-\u9fa5]+").matcher(s);        while(m.find()){            System.out.println(m.group());        }    }运行结果:Http://forum.csdn.net/PointForum/Forum/PostTopic.aspx?forumID=467d91e3-dd10-480b-a322-71b65e66c736http://forum.csdn.net/PointForum/Forum/PostTopic.aspxhttp://forum.csdn.net/PointForum 

热点排行