Skip to content

Instantly share code, notes, and snippets.

@yannisxu
Last active October 12, 2015 13:58
Show Gist options
  • Save yannisxu/4037276 to your computer and use it in GitHub Desktop.
Save yannisxu/4037276 to your computer and use it in GitHub Desktop.
Python:MatchIP
ipAddrPattern = re.compile('^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$')
ip_match = ipAddrPattern.match(ip)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment