Eric Foster 35b96bc934 initial commit | 6 years ago | |
---|---|---|
.. | ||
LICENSE | 6 years ago | |
README.md | 6 years ago | |
index.js | 6 years ago | |
package.json | 6 years ago |
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.