pillarjs/path-to-regexp

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

View on GitHub ↗Jump to charts ↓Open shareable report

Summary Information

Updated 9 minutes ago
Added to GitGenius on September 7th, 2026
Created on August 1st, 2012
Open Issues & Pull Requests: 11 (+0)
GitHub issues: Enabled
Number of forks: 486
Total Stargazers: 8,602 (+0)
Total Subscribers: 65 (+0)

Repository Insights (GitGenius)

Median issue/PR response: 4.7 hours
Mean response time: 9.7 days
90th percentile: 32.2 days
Tracked items: 45

How this project is maintained

Around half of the issues opened in the past year never receive a reply. Only 15% of issues opened in the past year have been closed. Three people close 84% of everything that gets resolved.

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 4
New in 7 days: 0
Closed in 7 days: 0
Avg open age: 405 days
Stale 30+ days: 4
Stale 90+ days: 3

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

  • question (5)
  • help wanted (2)
  • docs (1)
  • enhancement (1)
  • ideas (1)

Most active issues this week

No issue events were indexed in the last 7 days.

Detailed Description

path-to-regexp is a path parsing library that converts path strings with parameters into regular expressions for matching and route compilation.

The library solves the problem of matching dynamic URL paths against patterns and extracting named parameters from them. It works by parsing path strings that use a simple syntax—colons for named parameters like `:name`, asterisks for wildcard parameters that span segments, and braces for optional path segments—then converting these into regular expressions and metadata that can match incoming paths and extract their parameter values. The tool also provides a reverse operation through its compile function, which transforms parameter objects back into valid path strings.

Developers should choose this tool when building routers or path-matching systems in Node.js applications, particularly in Express-based frameworks where this pattern is standard. It handles the common case of ordered path data well, but the README explicitly notes it is not suitable for arbitrarily ordered data like query strings, URL fragments, or JSON. The library offers configuration options for case sensitivity, delimiter characters, and trailing slash handling, and supports custom encoding and decoding functions for parameter values. Developers working with paths containing special characters like emoji should consider using the recommended encodeurl library alongside it.

The project maintains a stable, focused codebase written in TypeScript that has established itself as a foundational utility in the Node.js routing ecosystem. Development activity shows consistent maintenance with attention to edge cases and developer experience, including detailed documentation of the parse, match, compile, and stringify functions. The maintainers provide clear guidance on usage patterns, such as when to disable encoding and decoding for path rewriting scenarios, and support custom path syntaxes for applications that cannot use the standard format.