# wildmatch

> A glob matching library with the same behaviour as git internal wildmatch function

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

## Install

```sh
npm install wildmatch
pnpm add wildmatch
yarn add wildmatch
bun add wildmatch
```

## 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-05-12 |
| First published | 2014-05-01 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 15 |
| Author | Vincent Meurisse |
| Maintainers | vmeurisse |
| Keywords | match, glob, wildmatch, minimatch, pattern |

## Links

- npm: https://www.npmjs.com/package/wildmatch
- Repository: https://github.com/vmeurisse/wildmatch
- Issues: https://github.com/vmeurisse/wildmatch/issues
- npm.io page: https://npm.io/package/wildmatch

## Recent versions

- 0.1.0 (latest) — 2014-05-12
- 0.0.1 — 2014-05-01

## README

Wildmatch [![NPM version](https://badge.fury.io/js/wildmatch.svg)](http://badge.fury.io/js/wildmatch) [![Build status](https://travis-ci.org/vmeurisse/wildmatch.svg?branch=master)](http://travis-ci.org/vmeurisse/wildmatch)
=========

Port in JS of the matching library used by Git.

Unlike other libraries like `minimatch`, it doesn't use regexp and use a real parser.

Usage
-----

````js
var wildmatch = require('wildmatch');

wildmatch('bar.foo', '*.foo'); //=> true
wildmatch('bar.foo', '*.bar'); //=> false
wildmatch('D', '[[:xdigit:]]'); //=> true
````

Syntax
------

Wildmatch support the following features:

 * `?`: Match a singe character
 * `*`: Match any string
 * Character classes: list (`[asd]`), ranges (`[a-z]`), POSIX named classes (`[[:alpha:]]`), negation (`[!a-f]` or `[^a-f]`)
 * Braces expansion: `file.{js,json}` will match `file.js` and `file.json`.
 * Sequences: `{-1..1}` will turn into (`-1` or `0` or `1`). You can also set a step size (`{-5..5..5}` => `-5`, `0`, `5`), use letters (`{a..e..2}` => `a`, `c`, `e`), and count backward (`{Z..X}` => `Z`, `Y`, `X`)
 * Extended glob: `pattern-list` is a list of patterns separated by `|`
   * `?(pattern-list)`: Matches zero or one occurrence of the given patterns
   * `*(pattern-list)`: Matches zero or more occurrences of the given patterns
   * `+(pattern-list)`: Matches one or more occurrences of the given patterns
   * `@(pattern-list)`: Matches one occurrences of the given patterns
   * `!(pattern-list)`: Matches anything except one of the given patterns

Options
-------

You can path an options object to wildmatch as third parameter. Options include:

 * `matchBase`: If set, then patterns without slashes will be matched against the basename of the path if it contains slashes. For example, `a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`.
 * `case`: if set to `false`, perform a case-insensitive match
 * `pathname`: if set, `?`, `*` and character class do not match the `/` character
 * `braces`: set it to `false` to disable the processing of curly braces (braces expansion and sequences)
 * `extglob`: set it to `false` to disable the match of extended glob pattern lists

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