diff --git a/docs/src/content/docs/reference/scripts/files.md b/docs/src/content/docs/reference/scripts/files.md index 3303dc9ca9..f35681ed8b 100644 --- a/docs/src/content/docs/reference/scripts/files.md +++ b/docs/src/content/docs/reference/scripts/files.md @@ -71,15 +71,13 @@ const fs = path.join(cur, "myfile.md) File path "globs" are patterns used to match file and directory names. They are commonly used in Unix-like operating systems and programming languages to specify sets of filenames with wildcard characters. This tutorial will cover the basics of using globs in file paths with workspace.findFiles. -#### What is a Glob? - -A file **glob** pattern is used to match file by name. Glob patterns can have the following syntax: - -- `*` to match zero or more characters in a path segment -- `?` to match on one character in a path segment -- `**` to match any number of path segments, including none -- `{}` to group conditions (e.g. `**/*.{ts,js}` matches all TypeScript and JavaScript files) -- `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on example.0, example.1, …) -- `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on example.a, example.b, but not example.0) +Glob patterns can have the following syntax: + +- `*` to match zero or more characters in a path segment +- `?` to match on one character in a path segment +- `**` to match any number of path segments, including none +- `{}` to group conditions (e.g. `**/*.{ts,js}` matches all TypeScript and JavaScript files) +- `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on example.0, example.1, …) +- `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on example.a, example.b, but not example.0) Note: a backslash (`\`\``) is not valid within a glob pattern. If you have an existing file path to match against, consider to use the relative pattern support that takes care of converting any backslash into slash. Otherwise, make sure to convert any backslash to slash when creating the glob pattern.