乐趣区

验证ipip段方法

1. 验证 IP 段:

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])){2}(\.(.)+)$/;
if(!reg.test(me.supEditForm.networkField)){console.log('ip 格式不正确');
    return ;
}

2. 验证 IP

var r = /^(\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])){3}$/;
     if(!r.test(me.osIPEditForm.ip)){console.log('ip 格式不正确');
     return ;
}
退出移动版