Devtools.supstudio.in

Tools/Regex

IPv6

What this is

IPv6 allows eliding runs of zeros with ::, zone ids, and embedded IPv4. A single regex that accepts every valid address and rejects every invalid one is a research paper. Use a parser for validation; use regex for coarse highlighting.

/\b(?:[0-9a-fA-F]{1,4}:){2,7}[0-9a-fA-F]{1,4}\b/g
2001:db8::1 is compressed and this simplified pattern may miss it.
2001:0db8:85a3:0000:0000:8a2e:0370:7334

Open in tester

FAQ

::1
Loopback often fails simplified patterns. Handle :: specially or use a library.

Related