Skip to main content
Regexflux

IPv6 Address (Simplified)

advanced

Matches common IPv6 address formats including compressed notation.

ipipv6networkvalidation

Pattern

/(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|(?:[0-9a-fA-F]{1,4}:)*:(?::[0-9a-fA-F]{1,4})*/g

Try It

0 of 6 strings matched

Explanation

Matches full IPv6 addresses (8 groups of 4 hex digits separated by colons) or compressed format with :: for consecutive zero groups.

Test Strings

Matching

  • 2001:0db8:85a3:0000:0000:8a2e:0370:7334
  • ::1
  • fe80::1

Non-matching

  • 192.168.1.1
  • hello
  • 1234

Language Compatibility

LanguageSupport
JSFull support
PYTHONFull support
JAVAFull support
PHPFull support
GOFull support

Code Snippets

const regex = /(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|(?:[0-9a-fA-F]{1,4}:)*:(?::[0-9a-fA-F]{1,4})*/g;
const text = "your text here";
const matches = text.match(regex);
console.log(matches);

Related Patterns