Return to Snippet

Revision: 72873
at March 14, 2018 17:43 by plasticbottle


Updated Code
function isValidIP(ip_str) {if(/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(ip_str)) {return true;} else return false;}

Revision: 72872
at March 14, 2018 17:42 by plasticbottle


Initial Code
function isValidIP(str) {if(/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(str)) {return true;} else return false;}

Initial URL

                                

Initial Description
JavaScript regex for validating IP addresses, has been tested!

Initial Title
JavaScript IP validation

Initial Tags
regex

Initial Language
JavaScript