# url-match

> url-match is a pattern matching for urls paths and query parameters

Latest version **0.1.0** (published 2014-04-12) · 0 weekly downloads

## Install

```sh
npm install url-match
pnpm add url-match
yarn add url-match
bun add url-match
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2014-04-12 |
| First published | 2014-04-12 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.8.5 |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| Author | Pol Miro |
| Maintainers | polmiro |
| Keywords | url, match, pattern, route, regex, match, path, query, parameter |

## Links

- npm: https://www.npmjs.com/package/url-match
- Repository: https://github.com/polmiro/url-match
- Homepage: http://github.com/polmiro/url-match
- Issues: http://github.com/polmiro/url-match/issues
- npm.io page: https://npm.io/package/url-match

## Dependencies (1)

- [underscore](https://npm.io/package/underscore.md) 1.6.0

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 0.1.0 (latest) — 2014-04-12

## README

# url-match

url-match is a pattern matching for urls paths and query parameters based on
the [backbone router](backbonejs.org) and the plugin [backbone-query-parameters](https://github.com/jhudson8/backbone-query-parameters)

### install

```
npm install url-match
```

**or**

put this line in the dependencies section of your `package.json`:

```
"url-match": "0.1.0"
```

then run:

```
npm install
```

### require

```javascript
var urlMatch = require('url-match');
```

### match urls

##### make pattern from string

```javascript
var pattern = urlPattern.generate('/users/:id');
```

##### match pattern against url

match returns the extracted parameters or `null` if there was no match:

```javascript
pattern.match('/projects/5'); // => null
pattern.match('/users/5'); // => [{id: '5'}, {}]
pattern.match('/users/5?a=b&c=d'); // => [{id: '5'}, {a: "b", c: "d"}]
```

---
_Source: https://npm.io/package/url-match · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
