DeskKit

Regex library

Regular expression for URL slugs

Match kebab-case URL slugs: lowercase letters, digits, and single hyphens. No leading or trailing hyphen.

^[a-z0-9]+(?:-[a-z0-9]+)*$

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.

    A slug is the bit of a URL humans might type. This pattern is the one DeskKit itself uses for programmatic pages: lowercase, digits, single hyphens, no edges.

    Uppercase, underscores, and double hyphens fail. Normalize titles to this form before you insert a row.

    What this pattern will not do

    Empty strings fail.

    Percent-encoded characters are not slugs; decode and then slugify.

    FAQ

    How do I allow underscores?

    You can, but hyphens are the web convention. Underscores hide in underlined links.

    Should slugs include a trailing slash?

    No. The slash is routing, not part of the slug.

    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.