日期:2014-05-19  浏览次数:20688 次

求写一个正则表达式
匹配要求: 在http://后面的以第一个/前不能出现 .(点)。例如 http://www.baidu.com/index.htm不匹配,
http://wwwbaiducom/indies.htm是匹配的
应该要使用到断言,但是新手不太会
求解
------最佳解决方案--------------------

String s="http://www.baidu.com/index.htm";
System.out.println(s.matches("http://[^\\.]+/.+"));

试试,不一定很准确,仅供参考。