Regex Explainer

    Regex Explainer

    Dissect any regex into a token-by-token plain-English breakdown

    ✓ Compiles as valid regex
    TokenMeaning
    ^Start of string (or line with /m)
    (?<scheme>Named capture group "scheme" — begin
    hLiteral 'h'
    tLiteral 't'
    tLiteral 't'
    pLiteral 'p'
    sLiteral 's'
    ?Quantifier — 0 or 1 (greedy)
    )Group — end
    :Literal ':'
    \/Literal '/'
    \/Literal '/'
    (?<host>Named capture group "host" — begin
    [^/:]Any character NOT in the set: /:
    +Quantifier — 1 or more (greedy)
    )Group — end
    (?:Non-capturing group — begin
    :Literal ':'
    (?<port>Named capture group "port" — begin
    \dAny digit (0-9)
    +Quantifier — 1 or more (greedy)
    )Group — end
    )Group — end
    ?Quantifier — 0 or 1 (greedy)
    (?<path>Named capture group "path" — begin
    \/Literal '/'
    [^?#]Any character NOT in the set: ?#
    *Quantifier — 0 or more (greedy)
    )Group — end
    ?Quantifier — 0 or 1 (greedy)
    (?:Non-capturing group — begin
    \?Literal '?'
    (?<query>Named capture group "query" — begin
    [^#]Any character NOT in the set: #
    *Quantifier — 0 or more (greedy)
    )Group — end
    )Group — end
    ?Quantifier — 0 or 1 (greedy)
    (?:Non-capturing group — begin
    #Literal '#'
    (?<frag>Named capture group "frag" — begin
    .Any character except newline (unless /s flag)
    *Quantifier — 0 or more (greedy)
    )Group — end
    )Group — end
    ?Quantifier — 0 or 1 (greedy)
    $End of string (or line with /m)

    About the Regex Explainer

    Regex is the most-reached-for tool in programming and the hardest to read. This explainer walks through your pattern token by token, naming each anchor, quantifier, group, and character class in English. Pair with the Regex Tester for full understanding: explain → verify → ship.

    Features

    How it works

    1. Paste a regex pattern.
    2. Review the token breakdown table.
    3. Check the 'compiles as valid' indicator — catches escape-balance mistakes.

    Use cases

    Frequently asked questions

    How is this different from the Regex Tester tool?

    +

    Regex Tester runs your regex against test strings and shows matches. Regex Explainer dissects the regex itself into human-readable tokens — complementary: use Explainer to understand, Tester to verify.

    Which regex flavor?

    +

    JavaScript / ECMAScript (RegExp). Features like possessive quantifiers (a++) aren't supported; lookbehind works on modern browsers.

    Does it explain PCRE / Python re?

    +

    Mostly — the core syntax is shared. Extensions specific to PCRE (e.g. atomic groups (?>)) are flagged as 'unknown' in the breakdown.

    Why are brackets still opaque in my breakdown?

    +

    Character classes [abc] are summarized as a single token. For finer-grained analysis, split classes and run each character through the tool individually.

    Can I test patterns here too?

    +

    Use our Regex Tester for live matching + highlighting; Regex Explainer focuses on explanation.