|
| 1 | +// package Wildmatch is an implementation of Git's wildmatch.c-style pattern |
| 2 | +// matching. |
| 3 | +// |
| 4 | +// Wildmatch patterns are comprised of any combination of the following three |
| 5 | +// components: |
| 6 | +// |
| 7 | +// - String literals. A string literal is "foo", or "foo\*" (matching "foo", |
| 8 | +// and "foo\", respectively). In general, string literals match their exact |
| 9 | +// contents in a filepath, and cannot match over directories unless they |
| 10 | +// include the operating system-specific path separator. |
| 11 | +// |
| 12 | +// - Wildcards. There are three types of wildcards: |
| 13 | +// |
| 14 | +// - Single-asterisk ('*'): matches any combination of characters, any |
| 15 | +// number of times. Does not match path separators. |
| 16 | +// |
| 17 | +// - Single-question mark ('?'): matches any single character, but not a |
| 18 | +// path separator. |
| 19 | +// |
| 20 | +// - Double-asterisk ('**'): greedily matches any number of directories. |
| 21 | +// For example, '**/foo' matches '/foo', 'bar/baz/woot/foot', but not |
| 22 | +// 'foo/bar'. Double-asterisks must be separated by filepath separators |
| 23 | +// on either side. |
| 24 | +// |
| 25 | +// - Character groups. A character group is composed of a set of included and |
| 26 | +// excluded character types. The set of included character types begins the |
| 27 | +// character group, and a '^' or '!' separates it from the set of excluded |
| 28 | +// character types. |
| 29 | +// |
| 30 | +// A character type can be one of the following: |
| 31 | +// |
| 32 | +// - Character literal: a single character, i.e., 'c'. |
| 33 | +// |
| 34 | +// - Character group: a group of characters, i.e., '[:alnum:]', etc. |
| 35 | +// |
| 36 | +// - Character range: a range of characters, i.e., 'a-z'. |
| 37 | +// |
| 38 | +// A Wildmatch pattern can be any combination of the above components, in any |
| 39 | +// ordering, and repeated any number of times. |
| 40 | +package wildmatch |
0 commit comments