https://github.com/open-tech-foundation/route-matcher
A route pattern matcher using regular expressions.
https://github.com/open-tech-foundation/route-matcher
match params path regexp route
Last synced: 8 months ago
JSON representation
A route pattern matcher using regular expressions.
- Host: GitHub
- URL: https://github.com/open-tech-foundation/route-matcher
- Owner: Open-Tech-Foundation
- License: mit
- Created: 2022-04-21T16:36:32.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-05-01T21:28:29.000Z (almost 4 years ago)
- Last Synced: 2025-02-27T22:15:46.103Z (12 months ago)
- Topics: match, params, path, regexp, route
- Language: TypeScript
- Homepage: https://route-matcher.pages.dev
- Size: 1.06 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Route Matcher
⚡ by [Open Tech World](https://open-tech-world.pages.dev/)
[](https://github.com/open-tech-world/route-matcher/actions/workflows/build.yml)
[](https://bundlephobia.com/package/@open-tech-world/route-matcher)
> A route pattern matcher using regular expressions.
## Features
- Simple API
- Strict parsing (See parser rules)
- Supports named & unnamed parameters
- Supports custom regular experssions
- Parameters can be repeated or optional
## Live Tester
[https://route-matcher.pages.dev/tester](https://route-matcher.pages.dev/tester)
## Installation
```bash
# With npm
$ npm install @open-tech-world/route-matcher
# With yarn
$ yarn add @open-tech-world/route-matcher
```
## Usage
```ts
import { routeMatcher } from "@open-tech-world/route-matcher";
routeMatcher(route: string, path: string): RouteSegment[] | null;
// Eg: routeMatcher("/path/:param", "/path/value");
```
## Documentation
Please read the complete documentation at: [https://route-matcher.pages.dev/](https://route-matcher.pages.dev/)
## License
Copyright (c) [Thanga Ganapathy](https://github.com/Thanga-Ganapathy) ([MIT License](./LICENSE)).