IPv6 Address Regex Pattern
Matches full IPv6 addresses in standard notation with 8 groups of 4 hexadecimal digits separated by colons.
Live Regex Tester
Pattern Breakdown
Code Examples
JavaScript
const regex = /^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$/;
const test = "2001:0db8:85a3:0000:0000:8a2e:0370:7334";
console.log(regex.test(test)); // true
// Extract matches
const matches = test.match(regex);
console.log(matches);Python
import re
pattern = r'^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$'
test = "2001:0db8:85a3:0000:0000:8a2e:0370:7334"
match = re.search(pattern, test)
print(match) # Found!Go
package main
import (
"fmt"
"regexp"
)
func main() {
re := regexp.MustCompile(`^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$`)
fmt.Println(re.MatchString("2001:0db8:85a3:0000:0000:8a2e:0370:7334")) // true
}Common Use Cases
Match Examples
| Input | Result |
|---|---|
| 2001:0db8:85a3:0000:0000:8a2e:0370:7334 | Match |
| 2001:db8::1 | No Match |
About the IPv6 Address Regex
Matches full IPv6 addresses in standard notation with 8 groups of 4 hexadecimal digits separated by colons.
Regular expressions (regex) are powerful pattern matching tools used across virtually all programming languages. The ipv6 address pattern is classified as advanced difficulty in the validation category. It works in all major programming languages.
When using this regex, always consider edge cases and test thoroughly with real-world data. Use the interactive tester above to validate the pattern against your specific inputs before deploying to production.
More Validation Patterns
Need More Regex Patterns?
Browse our complete library of 100+ regex patterns with interactive testers.
Frequently Asked Questions
What is the IPv6 Address regex pattern?
Matches full IPv6 addresses in standard notation with 8 groups of 4 hexadecimal digits separated by colons.
How do I use the IPv6 Address regex?
Use the pattern /^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$/ in your code. In JavaScript: new RegExp('^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$', ''). Test it above with your own input.
What does this IPv6 Address regex match?
This pattern matches: "2001:0db8:85a3:0000:0000:8a2e:0370:7334". It does NOT match: "2001:db8::1". Network configuration, DNS records, next-gen networking.
Is the IPv6 Address regex beginner-friendly?
This pattern is rated Advanced. It uses advanced features like lookaheads, backreferences, or complex alternation.
What languages support the IPv6 Address regex?
This pattern works in all major programming languages including JavaScript, Python, Java, C#, Go, Ruby, PHP, and more. Syntax may vary slightly between regex engines.
Can I modify the IPv6 Address regex for my use case?
Yes! Use the interactive tester above to modify the pattern and test with your own data. Common modifications include making it case-insensitive (add 'i' flag), matching globally (add 'g' flag), or adjusting character classes.