Created
November 19, 2015 11:32
-
-
Save arth2o/f27adefafffdc8cdd8fc to your computer and use it in GitHub Desktop.
JavaScript regexp ip validation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function validateIp(ipaddress) | |
{ | |
if (/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/.test(ipaddress)) | |
{ | |
return (true) | |
} | |
return (false) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment