npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

advanced-url-matcher

v1.0.6

Published

A comprehensive URL matching library.

Downloads

691

Readme

URL Matching Rules - Simple Guide

5 Core Matching Rules

These rules work everywhere: URL paths, query parameters, and JSON values.

1. Exact Match

Just write the value you want to match.

Pattern: /users/active
Matches: /users/active

2. Wildcard (* and **)

Matches anything or part of a value.

  • * matches any characters in a segment (or single segment).
  • ** (or :*) matches the rest of the path (multiple segments).
Pattern: /files/*
Matches: /files/doc.pdf, /files/image.png

Pattern: /api/**
Matches: /api/v1, /api/v1/users, /api/v1/users/123

Pattern: ?name=J*
Matches: ?name=John, ?name=Jane

3. List (,) - OR Logic

Match any value from a comma-separated list.

Pattern: /status/active,pending,closed
Matches: /status/active OR /status/pending OR /status/closed

Pattern: ?filter={"age":"18,25,30"}
Matches: ?filter={"age":18} OR ?filter={"age":25}

4. Range (..)

Match numbers within a range.

Pattern: /items/1..100
Matches: /items/1, /items/50, /items/100

5. Parameter (:name and :name?)

Capture a value (paths only). Add ? for optional parameters.

Pattern: /users/:id
Matches: /users/123
Captures: { id: "123" }

Pattern: /users/:id?
Matches: /users, /users/123

Inline Options

Add options directly in your pattern using [option1,option2] at the start.

Available Options

  • [exact] - URL must match exactly (no fuzzy matching).
  • [strict] - Trailing slashes must match exactly.
  • [ignoreQuery] - Completely ignores the query string.
  • [ignoreHash] - Ignores the hash fragment.
  • [strictQuery] - Disallows extra query parameters (default allows extra).

Example

matchUrl("[strict,strictQuery]/api/users", "/api/users?extra=1"); // ❌