...
/*ip正则表达式*/
/^((?:(?:25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))\.){3}(?:25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d))))$/ /*IP正则校验*/
function checkIsIp(ip) {
var pattern = /^((25[0-5]|2[0-4]\d|[01]?\d\d?)($|(?!\.$)\.)){4}$/;
if (!pattern .exec(ip)) return false
return true
}
/*IP正则校验 多个ip 之间使用 , 分割*/
function checkIsIps(ips) {
var reg = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/
var valdata = ips.split(',');
for(i=0;i<valdata.length;i++){
if(reg.test(valdata[i])== false){
return false;
}
}
return true
}