DeskKit

Regex library

Regular expression for IPv6 addresses

A strict JavaScript regex for fully expanded IPv6 addresses. Compressed forms such as ::1 are explained, not papered over.

^(?:[A-Fa-f0-9]{1,4}:){7}[A-Fa-f0-9]{1,4}$

Runs 100% in your browser. Nothing you paste is uploaded, stored, or sent to a server.

Flags

Highlighted matches

    How to use

    1. Scan the pre-filled pattern and the sample. Hits are highlighted; misses stay plain.
    2. Toggle flags if you need global or case-insensitive matching. The pattern is JavaScript / ECMAScript.
    3. Paste your own corpus. Nothing is sent to a server.
    4. Read the notes below before you drop the pattern into production — several of these are intentionally incomplete.

    Full-form IPv6 is eight hexadecimal groups. Compressed forms that use :: are a separate, much larger grammar. This page ships the full-form pattern so you can see a strict match, and it documents why ::1 does not pass.

    If you need compression, a dedicated parser beats a page-length regex. In an application, prefer a library or the URL / net APIs of your language.

    What this pattern will not do

    :: compression, IPv4 tails, and zone ids (%eth0) are out of scope for this pattern.

    Use it for teaching and for data that is already canonicalized to eight groups.

    FAQ

    Why does ::1 fail?

    Because this pattern requires eight groups. ::1 is valid IPv6 but compressed. Expand it to 0:0:0:0:0:0:0:1 or use a parser.

    Is the match case-sensitive?

    No. A–F and a–f are both accepted.

    Is the sample text uploaded?

    No. The tester compiles the pattern with the browser’s RegExp engine and stays on the device.

    DeskKit is a static site. Interactive tools require JavaScript.