Created
February 27, 2020 11:53
-
-
Save JohnPreston/41e8996bfeea0e3ee973b11fd310b7d2 to your computer and use it in GitHub Desktop.
Regexps for CIDR/IP validation (checks it is within 0-255 range)
This file contains 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
ipv4_ip = r'((((((([0-9]{1}\.))|([0-9]{2}\.)|(1[0-9]{2}\.)|(2[0-5]{2}\.)))){3})(((((([0-9]{1}))|([0-9]{2})|(1[0-9]{2})|(2[0-5]{2}))))){1,3})' | |
ipv4_ip_link = 'https://regex101.com/r/vIL3oX/3' | |
ipv4_cidr = r'((((((([0-9]{1}\.))|([0-9]{2}\.)|(1[0-9]{2}\.)|(2[0-5]{2}\.)))){3})(((((([0-9]{1}))|([0-9]{2})|(1[0-9]{2})|(2[0-5]{2}))))){1,3})\/(([0-9])|([1-2][0-9])|((3[0-2])))$' | |
ipv4_cidr_link = 'https://regex101.com/r/vIL3oX/4' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment