|
|
4 anni fa | |
|---|---|---|
| .. | ||
| LICENSE | 4 anni fa | |
| README.md | 4 anni fa | |
| index.js | 4 anni fa | |
| package.json | 4 anni fa | |
Convert extended globs to regex-compatible strings. Add (almost) the expressive power of regular expressions to glob patterns.
Install with npm
$ npm i extglob --save
Used by micromatch.
Features
{regex: true} to return a regexvar extglob = require('extglob');
extglob('?(z)');
//=> '(?:z)?'
extglob('*(z)');
//=> '(?:z)*'
extglob('+(z)');
//=> '(?:z)+'
extglob('@(z)');
//=> '(?:z)'
extglob('!(z)');
//=> '(?!^(?:(?!z)[^/]*?)).*$'
Optionally return regex
extglob('!(z)', {regex: true});
//=> /(?!^(?:(?!z)[^/]*?)).*$/
To learn more about how extglobs work, see the docs for Bash pattern matching:
?(pattern): Match zero or one occurrence of the given pattern.*(pattern): Match zero or more occurrences of the given pattern.+(pattern): Match one or more occurrences of the given pattern.@(pattern): Match one of the given pattern.!(pattern): Match anything except one of the given pattern.Install dev dependencies:
$ npm i -d && npm test
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Jon Schlinkert
Copyright © 2015 Jon Schlinkert Released under the MIT license.
This file was generated by verb-cli on August 01, 2015.