# micromatch [![NPM version](https://img.shields.io/npm/v/micromatch.svg?style=flat)](https://www.npmjs.com/package/micromatch) [![NPM monthly downloads](https://img.shields.io/npm/dm/micromatch.svg?style=flat)](https://npmjs.org/package/micromatch) [![NPM total downloads](https://img.shields.io/npm/dt/micromatch.svg?style=flat)](https://npmjs.org/package/micromatch) [![Linux Build Status](https://img.shields.io/travis/micromatch/micromatch.svg?style=flat&label=Travis)](https://travis-ci.org/micromatch/micromatch)
> Glob matching for javascript/node.js. A replacement and faster alternative to minimatch and multimatch.
Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
## Table of Contents
<details>
<summary><strong>Details</strong></summary>
- [Install](#install)
- [Quickstart](#quickstart)
- [Why use micromatch?](#why-use-micromatch)
* [Matching features](#matching-features)
- [Switching to micromatch](#switching-to-micromatch)
* [From minimatch](#from-minimatch)
* [From multimatch](#from-multimatch)
- [API](#api)
- [Options](#options)
- [Options Examples](#options-examples)
* [options.basename](#optionsbasename)
* [options.bash](#optionsbash)
* [options.expandRange](#optionsexpandrange)
* [options.format](#optionsformat)
* [options.ignore](#optionsignore)
* [options.matchBase](#optionsmatchbase)
* [options.noextglob](#optionsnoextglob)
* [options.nonegate](#optionsnonegate)
* [options.noglobstar](#optionsnoglobstar)
* [options.nonull](#optionsnonull)
* [options.nullglob](#optionsnullglob)
* [options.onIgnore](#optionsonignore)
* [options.onMatch](#optionsonmatch)
* [options.onResult](#optionsonresult)
* [options.posixSlashes](#optionsposixslashes)
* [options.unescape](#optionsunescape)
- [Extended globbing](#extended-globbing)
* [Extglobs](#extglobs)
* [Braces](#braces)
* [Regex character classes](#regex-character-classes)
* [Regex groups](#regex-groups)
* [POSIX bracket expressions](#posix-bracket-expressions)
- [Notes](#notes)
* [Bash 4.3 parity](#bash-43-parity)
* [Backslashes](#backslashes)
- [Benchmarks](#benchmarks)
* [Running benchmarks](#running-benchmarks)
* [Latest results](#latest-results)
- [Contributing](#contributing)
- [About](#about)
</details>
## Install
Install with [npm](https://www.npmjs.com/):
```sh
$ npm install --save micromatch
```
## Quickstart
```js
const micromatch = require('micromatch');
// micromatch(list, patterns[, options]);
```
The [main export](#micromatch) takes a list of strings and one or more glob patterns:
```js
console.log(micromatch(['foo', 'bar', 'baz', 'qux'], ['f*', 'b*'])) //=> ['foo', 'bar', 'baz']
console.log(micromatch(['foo', 'bar', 'baz', 'qux'], ['*', '!b*'])) //=> ['foo', 'qux']
```
Use [.isMatch()](#ismatch) to for boolean matching:
```js
console.log(micromatch.isMatch('foo', 'f*')) //=> true
console.log(micromatch.isMatch('foo', ['b*', 'f*'])) //=> true
```
[Switching](#switching-to-micromatch) from minimatch and multimatch is easy!
<br>
## Why use micromatch?
> micromatch is a [replacement](#switching-to-micromatch) for minimatch and multimatch
* Supports all of the same matching features as [minimatch](https://github.com/isaacs/minimatch) and [multimatch](https://github.com/sindresorhus/multimatch)
* More complete support for the Bash 4.3 specification than minimatch and multimatch. Micromatch passes _all of the spec tests_ from bash, including some that bash still fails.
* **Fast & Performant** - Loads in about 5ms and performs [fast matches](#benchmarks).
* **Glob matching** - Using wildcards (`*` and `?`), globstars (`**`) for nested directories
* **[Advanced globbing](#extended-globbing)** - Supports [extglobs](#extglobs), [braces](#braces-1), and [POSIX brackets](#posix-bracket-expressions), and support for escaping special characters with `\` or quotes.
* **Accurate** - Covers more scenarios [than minimatch](https://github.com/yarnpkg/yarn/pull/3339)
* **Well tested** - More than 5,000 [test assertions](./test)
* **Windows support** - More reliable windows support than minimatch and multimatch.
* **[Safe](https://github.com/micromatch/braces#braces-is-safe)** - Micromatch is not subject to DoS with brace patterns like minimatch and multimatch.
### Matching features
* Support for multiple glob patterns (no need for wrappers like multimatch)
* Wildcards (`**`, `*.js`)
* Negation (`'!a/*.js'`, `'*!(b).js']`)
* [extglobs](#extglobs) (`+(x|y)`, `!(a|b)`)
* [POSIX character classes](#posix-bracket-expressions) (`[[:alpha:][:digit:]]`)
* [brace expansion](https://github.com/micromatch/braces) (`foo/{1..5}.md`, `bar/{a,b,c}.js`)
* regex character classes (`foo-[1-5].js`)
* regex logical "or" (`foo/(abc|xyz).js`)
You can mix and match these features to create whatever patterns you need!
## Switching to micromatch
_(There is one notable difference between micromatch and minimatch in regards to how backslashes are handled. See [the notes about backslashes](#backslashes) for more information.)_
### From minimatch
Use [micromatch.isMatch()](#ismatch) instead of `minimatch()`:
```js
console.log(micromatch.isMatch('foo', 'b*')); //=> false
```
Use [micromatch.match()](#match) instead of `minimatch.match()`:
```js
console.log(micromatch.match(['foo', 'bar'], 'b*')); //=> 'bar'
```
### From multimatch
Same signature:
```js
console.log(micromatch(['foo', 'bar', 'baz'], ['f*', '*z'])); //=> ['foo', 'baz']
```
## API
**Params**
* `list` **{String|Array<string>}**: List of strings to match.
* `patterns` **{String|Array<string>}**: One or more glob patterns to use for matching.
* `options` **{Object}**: See available [options](#options)
* `returns` **{Array}**: Returns an array of matches
**Example**
```js
const mm = require('micromatch');
// mm(list, patterns[, options]);
console.log(mm(['a.js', 'a.txt'], ['*.js']));
//=> [ 'a.js' ]
```
### [.matcher](index.js#L104)
Returns a matcher function from the given glob `pattern` and `options`. The returned function takes a string to match as its only argument and returns true if the string is a match.
**Params**
* `pattern` **{String}**: Glob pattern
* `options` **{Object}**
* `returns` **{Function}**: Returns a matcher function.
**Example**
```js
const mm = require('micromatch');
// mm.matcher(pattern[, options]);
const isMatch = mm.matcher('*.!(*a)');
console.log(isMatch('a.a')); //=> false
console.log(isMatch('a.b')); //=> true
```
### [.isMatch](index.js#L123)
Returns true if **any** of the given glob `patterns` match the specified `string`.
**Params**
* `str` **{String}**: The string to test.
* `patterns` **{String|Array}**: One or more glob patterns to use for matching.
* `[options]` **{Object}**: See available [options](#options).
* `returns` **{Boolean}**: Returns true if any patterns match `str`
**Example**
```js
const mm = require('micromatch');
// mm.isMatch(string, patterns[, options]);
console.log(mm.isMatch('a.a', ['b.*', '*.a'])); //=> true
console.log(mm.isMatch('a.a', 'b.*')); //=> false
```
### [.not](index.js#L148)
Returns a list of strings that _**do not match any**_ of the given `patterns`.
**Params**
* `list` **{Array}**: Array of strings to match.
* `patterns` **{String|Array}**: One or more glob pattern to use for matching.
* `options` **{Object}**: See available [options](#options) for changing how matches are performed
* `returns` **{Array}**: Returns an array of strings that **do not match** the given patterns.
**Example**
```js
const mm = require('micromatch');
// mm.not(list, patterns[, options]);
console.log(mm.not(['a.a', 'b.b', 'c.c'], '*.a'));
//=> ['b.b', 'c.c']
```
### [.contains](index.js#L188)
Returns true if the given `string` contains the given pattern. Similar to [.isMatch](#isMatch) but the pattern can match any part of the string.
**Params**
* `str` **{String}**: The string to match.
* `p
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
eclipse-jee-2022-03-R-linux-gtk-x86_64.tar.gz (2000个子文件)
e4-dark_globalstyle.css 9KB
e4-dark_ide_colorextensions.css 9KB
e4-light_ide_colorextensions.css 5KB
e4-light_ide_colorextensions.css 5KB
urls.css 5KB
e4-dark_win.css 5KB
sample.css 5KB
e4-dark_tabstyle.css 4KB
narrow_book.css 4KB
book.css 4KB
e4_system.css 3KB
e4-dark_partstyle.css 3KB
e4-dark_preferencestyle.css 3KB
e4-light_tabstyle.css 3KB
e4_default_mac.css 3KB
e4-dark_mac1013.css 3KB
e4-light_tabstyle.css 3KB
e4_default_gtk.css 3KB
e4-light_globalstyle.css 2KB
e4_default_win.css 2KB
e4-light_globalstyle.css 2KB
e4-dark_mac.css 2KB
e4_classic.css 2KB
e4-dark_linux.css 2KB
urls.css 2KB
urls.css 2KB
urls.css 1KB
urls.css 1KB
whatsnew.css 1KB
urls.css 1KB
e4_basestyle.css 1KB
e4-light_partstyle.css 860B
e4-light_partstyle.css 860B
e4-light-drag-styling.css 831B
e4-light-drag-styling.css 831B
high-contrast.css 817B
e4-dark-drag-styling.css 769B
e4_globalstyle.css 761B
disabled_book.css 356B
macosx_narrow_book.css 269B
migrate.css 188B
overview.css 177B
simple.css 99B
plugin.css 77B
postProcessor.css 44B
simple.css 24B
jvmti.h 80KB
jni.h 74KB
classfile_constants.h 22KB
jawt.h 12KB
jdwpTransport.h 8KB
jvmticmlr.h 5KB
jni_md.h 2KB
jawt_md.h 2KB
readme_eclipse.html 76KB
about.html 29KB
epl-v20.html 17KB
epl-2.0.html 17KB
epl-2.0.html 17KB
epl-2.0.html 17KB
epl-v20.html 17KB
epl-2.0.html 17KB
epl-2.0.html 17KB
epl-2.0.html 17KB
epl-2.0.html 17KB
epl-2.0.html 17KB
epl-2.0.html 17KB
epl-2.0.html 17KB
epl-2.0.html 17KB
epl-2.0.html 17KB
epl-2.0.html 17KB
epl-2.0.html 17KB
epl-2.0.html 17KB
epl-2.0.html 17KB
epl-2.0.html 17KB
epl-2.0.html 17KB
epl-2.0.html 17KB
epl-v20.html 17KB
epl-2.0.html 17KB
epl-2.0.html 17KB
epl-2.0.html 17KB
epl-2.0.html 17KB
epl-2.0.html 17KB
epl-2.0.html 17KB
epl-2.0.html 17KB
epl-2.0.html 17KB
epl-2.0.html 17KB
epl-2.0.html 17KB
epl-2.0.html 17KB
epl-2.0.html 17KB
epl-2.0.html 17KB
epl-2.0.html 17KB
epl-v20.html 17KB
epl-2.0.html 17KB
epl-2.0.html 17KB
epl-2.0.html 17KB
epl-2.0.html 17KB
epl-2.0.html 17KB
epl-2.0.html 17KB
epl-2.0.html 17KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
- weixin_420416222023-12-19资源内容详细全面,与描述一致,对我很有用,有一定的使用价值。
- GNIXX2023-01-04资源很不错,内容和描述一致,值得借鉴,赶紧学起来!
- 缘来在2022-06-26用户下载后在一定时间内未进行评价,系统默认好评。
YunFeiDong
- 粉丝: 33
- 资源: 3849
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功