function checkIP(ip)
{
obj=ip ;
var exp=/^(d{1,2}|1dd|2[0-4]d|25[0-5]).(d{1,2}|1dd|2[0-4 ]d|25[0-5]).(d{1,2}|1dd|2[0-4]d|25[0-5]).(d{1,2}|1dd|2[0 -4]d|25[0-5])$/;
var reg = obj.match(exp);
if(reg==null)
{
return false;// Illegal
}
else
{
return true; //Legal
}
}
function checkMask(mask)
{
obj =mask;
var exp=/^(254|252|248|240|224|192|128|0).0.0.0|255.(254|252|248|240|224|192|128| 0).0.0|255.255.(254|252|248|240|224|192|128|0).0|255.255.255.(254|252|248|240|224|192|128|0)$/ ;
var reg = obj.match(exp);
if(reg==null)
{
return false; //"illegal"
}
else
{
return true; //"Legal"
}
}
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn