JavaScript验证URL地址的正则
function IsURL(str_url){var strRegex = "^((https|http|ftp|rtsp|mms)?://)"+ "?((+: )?+@)?" //ftp的user@+ "(({1,3}\.){3}{1,3}" // IP形式的URL- 199.194.52.184+ "|" // 允许IP和DOMAIN(域名)+ "(+\.)*" // 域名- www.+ "({0,61})?\." // 二级域名+ "{2,6})" // first level domain- .com or .museum+ "(:{1,4})?" // 端口- :80+ "((/?)|" // a slash isn't required if there is no file name+ "(/+)+/?)$";var re=new RegExp(strRegex);//re.test()if (re.test(str_url)){return true;}else{return false;}}
页:
[1]