Regex for IPv6 Address
Matches full IPv6 addresses in standard notation (8 groups of 4 hex digits separated by colons).
Pattern
/^(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$/Pattern Breakdown
| Token | Explanation |
|---|---|
| ^ | Start of string |
| (?:[0-9a-fA-F]{1,4}:) | 1-4 hex digits followed by colon |
| {7} | Repeat 7 times (first 7 groups) |
| [0-9a-fA-F]{1,4} | Final group of 1-4 hex digits |
| $ | End of string |
Test Examples
| Input | Match? |
|---|---|
| 2001:0db8:85a3:0000:0000:8a2e:0370:7334 | Match |
| fe80:0000:0000:0000:0000:0000:0000:0001 | Match |
| ::1 | No match |
| 192.168.1.1 | No match |
Common Use Cases
- IPv6 address validation
- Network configuration
- DNS record validation
Variations
^([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}$Allows compressed notation with ::
Other Regex Patterns
Want to test this pattern with your own data?
Open the Regex Tester