Created
December 14, 2021 09:15
-
-
Save arush-sal/801a2486036dfdb558f899d4ba2af72c to your computer and use it in GitHub Desktop.
IPv4 Socket Address Regex
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
def is_ipv4_socket_address(network): | |
return re.match(r"^(([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]):([0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$",network) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment