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 hidden or 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
From @asins, but to match a single ipv4/v6 (no leading/trailing spaces, no global flag).