求正则
不是 http://www.sina.com
也不是 http://pro.sina.com
任意 http://xxx.sina.com都可以 满足以上条件
但是至少xxx要是一个字符串不能是空
不是 http://www.sina.com
也不是 http://pro.sina.com
任意 http://xxx.sina.com都可以 满足以上条件
但是至少xxx要是一个字符串不能是空
调试欢乐多
你没有考虑这样的情况?建议就https{0,1}:/{2,}[^\n\r]*sina\.com或者其他的
https://sina.com
http://////////sina.com
世界上的SB很多的,楼主小心啊。
var reg=/http:\/\/(?!www|pro)\w+\.sina\.com/;
alert(reg.test(s));
alert(reg.test(s2));
alert(reg.test(s3));
不过最好加上^$
reg=/^http:\/\/(?!www|pro)\w+\.sina\.com$/;