Title |
Test
Find
IPv6 Address
|
Expression |
(^\d{20}$)|(^((:[a-fA-F0-9]{1,4}){6}|::)ffff:(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[0-9]{1,2})(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[0-9]{1,2})){3}$)|(^((:[a-fA-F0-9]{1,4}){6}|::)ffff(:[a-fA-F0-9]{1,4}){2}$)|(^([a-fA-F0-9]{1,4}) (:[a-fA-F0-9]{1,4}){7}$)|(^:(:[a-fA-F0-9]{1,4}(::)?){1,6}$)|(^((::)?[a-fA-F0-9]{1,4}:){1,6}:$)|(^::$) |
Description |
This matches all valid forms of an IPv6 address. Including the compatibility form used to map IPv4 addresses. As well as the base-85 encoded integer form.
It takes care of value range checking on the ipv4 part (components cannot exceed 0-255).
This has been tested quite thoroughly, but considering the complexity and possibilities in the formation of an IPv6 address, matching errors are not guaranteed to be absent. |
Matches |
::5:aef1:ffff | ::ffff:240.65.238.22 | 0:0:0:0:0:0:0:1 |
Non-Matches |
79250:9a0: | 8 | 91cf91d3da9 |
Author |
Rating:
jteeuwen
|
Source |
|
Your Rating |
|
Title: Found Issue on Wikipedia
Name: DF
Date: 2/6/2014 6:23:55 AM
Comment:
I found this valid IPv6 address on wikipedia:
2001:0db8:0000:08d3:0000:8a2e:0070:7344
However your regex states it as not valid. :(
Title: Flawed
Name: Aeron
Date: 6/17/2010 8:33:29 AM
Comment:
::1111:: is accepted