Created
November 20, 2013 18:44
-
-
Save pyrocat101/7568655 to your computer and use it in GitHub Desktop.
IPv4 and IPv6 Address RegExp
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
var IPV4 = /^(25[0-5]|2[0-4][0-9]|1?[0-9][0-9]{1,2})(\.(25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})){3}$/, | |
IPV6 = /^([0-9a-f]){1,4}(:([0-9a-f]){1,4}){7}$/i; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks thanks so much!!! great great regex here!
just improved to validate masks ( maximum /32 for ipv4 and maximum /128 for ipv6)... masks are optional.