How to check validation of IP Address in jquery
The short version:
^(?!0)(?!.*\.$)((1?\d?\d|25[0-5]|2[0-4]\d)(\.|$)){4}$
Explained here https://stackoverflow.com/a/26445549/3356679
refer this document IP validation
here he has used jqueryvalidator.js and explained with an example.
$.validator.addMethod('IP4Checker', function(value) {
return value.match(/^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$/);
}, 'Invalid IP address');
$('#form1').validate({
rules: {
ip: {
required: true,
IP4Checker: true
}
}
});