Skip to content

Instantly share code, notes, and snippets.

@Oleg-Sulzhenko
Created January 11, 2019 17:03
Show Gist options
  • Save Oleg-Sulzhenko/a48dfa1d6279167e5f0b34ed7d56f253 to your computer and use it in GitHub Desktop.
Save Oleg-Sulzhenko/a48dfa1d6279167e5f0b34ed7d56f253 to your computer and use it in GitHub Desktop.
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;}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment