I want to check the range of ip address in a regular expression , I was using this way and it's working so successfully
function validate_ip(ip)
{
// See if x looks like an IP address using our "almost IP regex".
var regex = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;
var match = regex.exec(ip);
if (!match) return false;
// Additional code to check that the octets aren't greater than 255:
for (var i = 1; i <= 4; ++i) {
if (parseInt(match[i]) > 255)
return false;
}
return true;
}
now i want to perform checking of the range and the syntax in just regular expression can this be done ?