Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
**Heads up!**: This library only supports extglobs, to handle full glob patterns and other extended globbing features use [micromatch](https://github.com/jonschlinkert/micromatch) instead.
The main export is a function that takes a string and options, and returns an object with the parsed AST and the compiled `.output`, which is a regex-compatible string that can be used for matching.
```js
var extglob = require('extglob');
console.log(extglob('!(xyz)*.js'));
```
## Extglob cheatsheet
Extended globbing patterns can be defined as follows (as described by the [bash man page](https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html)):
extglob x 2,228,255 ops/sec ±0.98% (89 runs sampled)
minimatch x 207,875 ops/sec ±0.61% (91 runs sampled)
fastest is extglob (by 1072% avg)
# negation-simple (43 bytes)
extglob x 2,205,668 ops/sec ±1.00% (91 runs sampled)
minimatch x 311,923 ops/sec ±1.25% (91 runs sampled)
fastest is extglob (by 707% avg)
# range-false (57 bytes)
extglob x 2,263,877 ops/sec ±0.40% (94 runs sampled)
minimatch x 271,372 ops/sec ±1.02% (91 runs sampled)
fastest is extglob (by 834% avg)
# range-true (56 bytes)
extglob x 2,161,891 ops/sec ±0.41% (92 runs sampled)
minimatch x 268,265 ops/sec ±1.17% (91 runs sampled)
fastest is extglob (by 806% avg)
# star-simple (46 bytes)
extglob x 2,211,081 ops/sec ±0.49% (92 runs sampled)
minimatch x 343,319 ops/sec ±0.59% (91 runs sampled)
fastest is extglob (by 644% avg)
```
## Differences from Bash
This library has complete parity with Bash 4.3 with only a couple of minor differences.
* In some cases Bash returns true if the given string "contains" the pattern, whereas this library returns true if the string is an exact match for the pattern. You can relax this by setting `options.contains` to true.
* This library is more accurate than Bash and thus does not fail some of the tests that Bash 4.3 still lists as failing in their unit tests
## About
<details>
<summary><strong>Contributing</strong></summary>
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
</details>
<details>
<summary><strong>Running Tests</strong></summary>
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
To generate the readme, run the following command:
* [braces](https://www.npmjs.com/package/braces): Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support… [more](https://github.com/micromatch/braces) | [homepage](https://github.com/micromatch/braces "Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support for the Bash 4.3 braces specification, without sacrificing speed.")
* [expand-range](https://www.npmjs.com/package/expand-range): Fast, bash-like range expansion. Expand a range of numbers or letters, uppercase or lowercase. Used… [more](https://github.com/jonschlinkert/expand-range) | [homepage](https://github.com/jonschlinkert/expand-range "Fast, bash-like range expansion. Expand a range of numbers or letters, uppercase or lowercase. Used by [micromatch].")
* [fill-range](https://www.npmjs.com/package/fill-range): Fill in a range of numbers or letters, optionally passing an increment or `step` to… [more](https://github.com/jonschlinkert/fill-range) | [homepage](https://github.com/jonschlinkert/fill-range "Fill in a range of numbers or letters, optionally passing an increment or `step` to use, or create a regex-compatible range with `options.toRegex`")
* [micromatch](https://www.npmjs.com/package/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. | [homepage](https://github.com/micromatch/micromatch "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.")