一级域名如:http://www.baidu.com 或 http://www.baidu.com.cn二级域名如: http://aaa.baidu.com 或 http://aaa.baidu.com.cn正则改怎么写,多谢赐教,感谢先!
解决方案 »
- JQUERY的表单判断问题,求围观,百分百结贴
- 当multiple为true时,listbox选项交换的问题。
- document的表单问题
- JS media player 频谱的问题 急~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- 用javascript做网页和图片
- 在 做注册会员时 在开头检测用户名是否被注册
- 如何实现在指定时间弹出窗口或者对话框,,具体思想请进。。。。。
- 为什么会出现"Location不是对象"的错误?
- 如何得到<input type="file">选中的文件的文件名称 和 路径?
- 帮忙分析一下这个函数。
- 如何让它在谷歌里里能显示?麻烦了
- 这个clearInterval(tmp)为什么不能终止函数的重复调用
var s = "http://www.baidu.com";//http://www.baidu.com.cn
var reg = /^http:\/\/www\.\w.+\.(com|cn)/;
alert(reg.test(s));
var s = "http://www.baidu.com.cn";//http://www.baidu.com.cn
var reg = /^http:\/\/www\.\w.+\.com(\.cn)?$/;
alert(reg.test(s));
var s = "http://www.baidu.com.cn";//http://www.baidu.com.cn
//var reg = /^http:\/\/www\.\w.+\.\w+(\.\w+)?$/;
var reg = /^http:\/\/\w+\.\w+\.\w+(\.\w+)?$/;
alert(reg.test(s));
</script>
var reg = /^http:\/\/\w+\.\w+\.\w+(\.\w+)?$/;//二级