日期:2014-05-20 浏览次数:20834 次
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-71b65e66c736 http://forum.csdn.net/PointForum/Forum/PostTopic.aspx http://forum.csdn.net/PointForum