OLD | NEW |
---|---|
1 `glob` is a file and directory globbing library that supports both checking | 1 `glob` is a file and directory globbing library that supports both checking |
2 whether a path matches a glob and listing all entities that match a glob. | 2 whether a path matches a glob and listing all entities that match a glob. |
3 | 3 |
4 A "glob" is a pattern designed specifically to match files and directories. Most | 4 A "glob" is a pattern designed specifically to match files and directories. Most |
5 shells support globs natively. | 5 shells support globs natively. |
6 | 6 |
7 ## Usage | 7 ## Usage |
8 | 8 |
9 To construct a glob, just use `new Glob()`. As with `RegExp`s, it's a good idea | 9 To construct a glob, just use `new Glob()`. As with `RegExp`s, it's a good idea |
10 to keep around a glob if you'll be using it more than once so that it doesn't | 10 to keep around a glob if you'll be using it more than once so that it doesn't |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 ## Syntax | 43 ## Syntax |
44 | 44 |
45 The glob syntax hews closely to the widely-known Bash glob syntax, with a few | 45 The glob syntax hews closely to the widely-known Bash glob syntax, with a few |
46 exceptions that are outlined below. | 46 exceptions that are outlined below. |
47 | 47 |
48 In order to be as cross-platform and as close to the Bash syntax as possible, | 48 In order to be as cross-platform and as close to the Bash syntax as possible, |
49 all globs use POSIX path syntax, including using `/` as a directory separator | 49 all globs use POSIX path syntax, including using `/` as a directory separator |
50 regardless of which platform they're on. This is true even for Windows roots; | 50 regardless of which platform they're on. This is true even for Windows roots; |
51 for example, a glob matching all files in the C drive would be `C:/*`. | 51 for example, a glob matching all files in the C drive would be `C:/*`. |
52 | 52 |
53 Globs are case-sensitive by default on Posix systems and browsers, and | |
54 case-sensitive by default on Windows. | |
Bob Nystrom
2015/12/02 01:01:43
"insensitive"
nweiz
2015/12/02 01:33:01
Done.
| |
55 | |
53 ### Match any characters in a filename: `*` | 56 ### Match any characters in a filename: `*` |
54 | 57 |
55 The `*` character matches zero or more of any character other than `/`. This | 58 The `*` character matches zero or more of any character other than `/`. This |
56 means that it can be used to match all files in a given directory that match a | 59 means that it can be used to match all files in a given directory that match a |
57 pattern without also matching files in a subdirectory. For example, `lib/*.dart` | 60 pattern without also matching files in a subdirectory. For example, `lib/*.dart` |
58 will match `lib/glob.dart` but not `lib/src/utils.dart`. | 61 will match `lib/glob.dart` but not `lib/src/utils.dart`. |
59 | 62 |
60 ### Match any characters across directories: `**` | 63 ### Match any characters across directories: `**` |
61 | 64 |
62 `**` is like `*`, but matches `/` as well. It's useful for matching files or | 65 `**` is like `*`, but matches `/` as well. It's useful for matching files or |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
115 | 118 |
116 Because they're used as part of the shell, almost all strings are valid Bash | 119 Because they're used as part of the shell, almost all strings are valid Bash |
117 globs. This implementation is more picky, and performs some validation to ensure | 120 globs. This implementation is more picky, and performs some validation to ensure |
118 that globs are meaningful. For instance, unclosed `{` and `[` are disallowed. | 121 that globs are meaningful. For instance, unclosed `{` and `[` are disallowed. |
119 | 122 |
120 ### Reserved syntax: `(...)` | 123 ### Reserved syntax: `(...)` |
121 | 124 |
122 Parentheses are reserved in case this package adds support for Bash extended | 125 Parentheses are reserved in case this package adds support for Bash extended |
123 globbing in the future. For the time being, using them will throw an error | 126 globbing in the future. For the time being, using them will throw an error |
124 unless they're escaped. | 127 unless they're escaped. |
OLD | NEW |