DeskKit

Regex library

Regular expression for UUIDs

A JavaScript regex for RFC 4122 UUIDs, including version and variant nibbles. The nil UUID is rejected on purpose.

^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$

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.

    Most “UUID regex” snippets only check 8-4-4-4-12 hex. This one also checks that the version nibble is 1–8 and the variant nibble is 8, 9, a, or b, which is what RFC 4122 requires.

    The i flag lets uppercase A–F through. The nil UUID fails because its version nibble is 0 — that matches the generator tool on this site.

    What this pattern will not do

    UUIDv7 is version 7, which this pattern allows.

    Braced form {uuid} is not accepted; strip braces first.

    FAQ

    Why reject the nil UUID?

    It is a reserved sentinel, not a generated identifier. If you must accept it, change the version class to [0-8].

    Does this prove uniqueness?

    No. It only checks shape. Uniqueness comes from how the bits were generated.

    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.