Initial commit
[yaffs-website] / node_modules / extglob / README.md
1 # extglob [![NPM version](https://badge.fury.io/js/extglob.svg)](http://badge.fury.io/js/extglob)  [![Build Status](https://travis-ci.org/jonschlinkert/extglob.svg)](https://travis-ci.org/jonschlinkert/extglob)
2
3 > Convert extended globs to regex-compatible strings. Add (almost) the expressive power of regular expressions to glob patterns.
4
5 Install with [npm](https://www.npmjs.com/)
6
7 ```sh
8 $ npm i extglob --save
9 ```
10
11 Used by [micromatch](https://github.com/jonschlinkert/micromatch).
12
13 **Features**
14
15 * Convert an extglob string to a regex-compatible string. **Only converts extglobs**, to handle full globs use [micromatch](https://github.com/jonschlinkert/micromatch).
16 * Pass `{regex: true}` to return a regex
17 * Handles nested patterns
18 * More complete (and correct) support than [minimatch](https://github.com/isaacs/minimatch)
19
20 ## Usage
21
22 ```js
23 var extglob = require('extglob');
24
25 extglob('?(z)');
26 //=> '(?:z)?'
27 extglob('*(z)');
28 //=> '(?:z)*'
29 extglob('+(z)');
30 //=> '(?:z)+'
31 extglob('@(z)');
32 //=> '(?:z)'
33 extglob('!(z)');
34 //=> '(?!^(?:(?!z)[^/]*?)).*$'
35 ```
36
37 **Optionally return regex**
38
39 ```js
40 extglob('!(z)', {regex: true});
41 //=> /(?!^(?:(?!z)[^/]*?)).*$/
42 ```
43
44 ## Extglob patterns
45
46 To learn more about how extglobs work, see the docs for [Bash pattern matching](https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html):
47
48 * `?(pattern)`: Match zero or one occurrence of the given pattern.
49 * `*(pattern)`: Match zero or more occurrences of the given pattern.
50 * `+(pattern)`: Match one or more occurrences of the given pattern.
51 * `@(pattern)`: Match one of the given pattern.
52 * `!(pattern)`: Match anything except one of the given pattern.
53
54 ## Related
55
56 * [braces](https://github.com/jonschlinkert/braces): Fastest brace expansion for node.js, with the most complete support for the Bash 4.3 braces… [more](https://github.com/jonschlinkert/braces)
57 * [expand-brackets](https://github.com/jonschlinkert/expand-brackets): Expand POSIX bracket expressions (character classes) in glob patterns.
58 * [expand-range](https://github.com/jonschlinkert/expand-range): Fast, bash-like range expansion. Expand a range of numbers or letters, uppercase or lowercase. See… [more](https://github.com/jonschlinkert/expand-range)
59 * [fill-range](https://github.com/jonschlinkert/fill-range): Fill in a range of numbers or letters, optionally passing an increment or multiplier to… [more](https://github.com/jonschlinkert/fill-range)
60 * [micromatch](https://github.com/jonschlinkert/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. Just… [more](https://github.com/jonschlinkert/micromatch)
61
62 ## Run tests
63
64 Install dev dependencies:
65
66 ```sh
67 $ npm i -d && npm test
68 ```
69
70 ## Contributing
71
72 Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/extglob/issues/new)
73
74 ## Author
75
76 **Jon Schlinkert**
77
78 + [github/jonschlinkert](https://github.com/jonschlinkert)
79 + [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
80
81 ## License
82
83 Copyright © 2015 Jon Schlinkert
84 Released under the MIT license.
85
86 ***
87
88 _This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on August 01, 2015._