# pillarjs/path-to-regexp

Turn a path string such as `/user/:name` into a regular expression

Repository: https://github.com/pillarjs/path-to-regexp
Canonical: https://ross.abutalabs.com/products/path-to-regexp
Language: TypeScript
License: MIT
License Family: permissive
Topics: path-to-regexp, expressjs, router, nodejs
Last push: 2026-08-04T04:30:19+00:00

## Health v2 (maintenance only)
Score: 90/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 96, release rhythm 77, longevity 100
- inputs: {"age_days": 5145, "days_push": 29, "days_rel": 154, "gap_med": 1.0, "n_releases_24m": 13}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 8602, forks 484 (observed 2026-08-28T04:10:23.757547+00:00)

## What it is
A TypeScript library that converts path strings like `/user/:name` into regular expressions for route matching. It supports named parameters, wildcards, optional segments, and reverse compilation of paths from parameters.

## Use cases
- match url paths with named parameters like /user/:name
- convert route patterns to regular expressions
- extract route params from a url path
- build a router with wildcard and optional path segments
- generate url paths from route templates and params
- validate whether a path matches a route pattern

## When to choose
- you need express-style path matching in a nodejs router or framework
- you want to parse parameters from ordered path strings
- you need to compile parameterized paths back into url strings

## When to avoid
- you need to match query strings or arbitrarily ordered url data
- you need a full-featured router rather than a path-matching utility
- you are not working with path-like ordered strings

## Facets
- artifact type: library
- maturity: stable
- function: routing, parser, web-framework
- domain: web-development, backend, developer-tools
- platform: -
- tags: path-matching, regexp, express, url-routing, route-parameters, nodejs, javascript, typescript

## Member repositories
- pillarjs/path-to-regexp (main) score 90

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:10:23.757547+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T17:26:08.201573+00:00, confidence not recorded.
  - readme: https://github.com/pillarjs/path-to-regexp (fetched 2026-08-28T04:10:23.757547+00:00, sha a8be0563de59)
  - registry_npm: https://registry.npmjs.org/path-to-regexp (fetched 2026-08-29T08:26:37.436312+00:00, sha c1bccda46d5e)
- Data as of 2026-08-30T08:39:29.467469+00:00.
