Back to all patterns
IPv6 CIDR Block
Web & Network
Matches an IPv6 address (loosely) with a /0–/128 mask.
/^[0-9a-fA-F:]+/(?:12[0-8]|1[01][0-9]|[1-9]?[0-9])$/How it works
Full IPv6 validation is brutal in regex; this pattern accepts any hex/colon string in the address position and strictly bounds the mask. Combine with the IPv6 strict validator for full address checking.
Test Cases
Should Match
- 2001:db8::/32
- ::/0
- fe80::/10
- ::1/128
Should NOT Match
- 2001:db8::/129
- ::/
- 12345/64
Quick Summary
Matches an IPv6 CIDR (mask 0–128). The address portion is loosely validated; pair with the strict IPv6 pattern if needed.