|
15 | 15 | Examples: |
16 | 16 |  |
17 | 17 |
|
| 18 | +### Multi-glob syntax |
| 19 | + |
| 20 | +Multi-glob syntax lets the user search space-separated words or [globs](https://en.wikipedia.org/wiki/Glob_(programming)). __This syntax is case-insensitive.__ The rules are as follows: |
| 21 | + |
| 22 | +1. `foo bar txt` matches anything that contains the words `foo`, `bar`, and `txt`, for example `foobar.txt` *but not `bar.txt` or `foo.bar`* |
| 23 | + * __Note that this is the same as the old behavior of NavigateTo before the introduction of glob syntax, so the old search behavior is retained.__ |
| 24 | +2. `foo | bar` matches anything that contains *`foo` OR `bar`*, for example `foo.txt` and `bar.txt` |
| 25 | +3. `foo | <bar baz>` matches *`foo` OR (`bar` AND `baz`)*, like `foo.txt` and `bar.baz` but not `bar.txt`. That is, `<>` are grouping parentheses, although *`<` does not require a closing `>`*. |
| 26 | +4. `foo !bar` matches *`foo` AND NOT `bar`*, that is, `!` before a search term represents logical negation. So `foo !bar` matches `foo.txt` but not `foo.bar` |
| 27 | +5. `*.foo` uses *glob syntax* and matches anything that has the `.foo` extension. |
| 28 | + * __Note that anything using the `*`, `[]`, and `{}` characters is considered a glob, and the end of the glob must match the end of the search target.__ |
| 29 | + * For example, while `foo` matches `foo.txt` or `txt.foo`, __`*.foo` matches `txt.foo` *but not `foo.txt`*__ |
| 30 | +6. `*` matches any number of characters (including zero) *other than the path separator `\`.* Thus `r.c*` matches `bar.c` and `gor.cpp` *but not `jir.c\foo.bar`* |
| 31 | +7. `?` matches *any one character* other than the path separator `\`. Thus `foo.?` matches `foo.h` and `foo.c` but not `foo.cpzp` or `foo.h\bar.py` |
| 32 | +8. `[chars]` matches any one character inside the square brackets. It also matches *character ranges*, specifically `a-z`, `A-Z`, and `0-9` or any subset thereof. |
| 33 | + * `*.a[0-2]` matches `foo.a0`, `foo.a1`, and `foo.a1` |
| 34 | + * `*.[x-y1][7-8]` matches `foo.x7`, `foo.x8`, `foo.y7`, `foo.y8`, `foo.17`, and `foo.18` |
| 35 | + * `big[ _]dog.txt` matches `big dog.txt` and `big_dog.txt` |
| 36 | +9. `[!chars]` matches *any one character __not__ inside the square brackets other than `\`.* Just as with `[chars]`, character groups can be negated. |
| 37 | + * `*.[!1-2]` matches `foo.a` and `foo.g` and `foo.3` *but not `foo.1` or `foo.2` or `foo.\bar.txt`* |
| 38 | +10. `\xNN` matches a unicode character at codepoint `NN`. For example, `\x21` matches the exclamation point `!`. |
| 39 | + * `\xNN` escapes can be used in character classes. For example, `[\x61-\x6a]` matches the letters `a-z`. |
| 40 | +11. `\uNNNN` matches a unicode character at codepoint `NNNN` |
| 41 | + * `\u0021` also matches `!` |
| 42 | + * `\u0434` matches the Cyrillic character `д` |
| 43 | + * `\uNNNN` escapes can be used in character classes. For example, `[\u03B1-\u03C9]` matches the lower-case Greek letters `α` through `ω`. |
| 44 | +12. `*.{foo,bar,baz}` matches `a.foo`, `a.bar`, and `a.baz`. That is, `{OPTION1,OPTION2,...,OPTIONN}` matches each comma-separated option within the `{}` |
| 45 | + * You can use multiple `{}` alternations within the same glob. For example, `{foo,bar}.{txt,md}` matches `foo.txt`, `foo.md`, `bar.txt`, and `bar.md` |
| 46 | + |
| 47 | +#### Glob syntax "kitchen sink" example, `foo**[!c-p]u\u0434ck*.{tx?,cpp} !fgh | <ba\x72 baz` |
| 48 | + |
| 49 | +##### Matches |
| 50 | +1. `foo\boo\quдcked.txt` (recall that `\u0434` is `д`) |
| 51 | +2. `foo\boo\quдcked.cpp` |
| 52 | +3. `foozuдck.txb` |
| 53 | +4. `bar.baz` (note that `\x72` is `r`) |
| 54 | +5. `baz.bar` |
| 55 | +6. `fgh\bar.baz` (`fgh` is forbidden if the glob is being matched, but not if `bar baz` is being matched) |
| 56 | + |
| 57 | +##### Non-matches |
| 58 | +1. `foo\boo\duдcked.txt` (the `d` in `duдcked` is in the character class `c-p`, which was negated) |
| 59 | +2. `foozuдck.xml` (the `xml` extension does not match `tx?`) |
| 60 | +3. `foo.baz` (does not match the fancy glob, and it doesn't contain both `bar` and `baz`) |
| 61 | +4. `foo\boo\quдcked.txto` (`txto` does not match `tx?` __because globs are always anchored at the end__ and `txto` has an `o` after the matching portion) |
| 62 | +7. `foo\fgh\quдcked.txt` (contains the forbidden search term `fgh`) |
| 63 | +8. `foo\boo\quдcked\bad.txt` (`uдck*` matches *any characters after* `uдck` *other than `\`*) |
| 64 | + |
| 65 | + |
18 | 66 | ### Fuzzy Tabs Search |
19 | 67 | Fuzzy search is based on: https://en.wikipedia.org/wiki/Longest_common_subsequence_problem |
20 | 68 | Highlight is based on character. |
|
0 commit comments