Skip to content

Instantly share code, notes, and snippets.

@Foolson
Created May 26, 2020 10:49
Show Gist options
  • Save Foolson/3ef5e4bf23b4b0f9bfd4605fff94c3cc to your computer and use it in GitHub Desktop.
Save Foolson/3ef5e4bf23b4b0f9bfd4605fff94c3cc to your computer and use it in GitHub Desktop.
import re
ipv4_pattern = re.compile(r'^1?[0-9]{1,2}\.1?[0-9]{1,2}\.1?[0-9]{1,2}\.1?[0-9]{1,2}|2[0-4][0-9]\.2[0-4][0-9]\.2[0-4][0-9]\.2[0-4][0-9]|25[0-5]\.25[0-5]\.25[0-5]\.25[0-5]$')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment