GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Agents
  • Models
  • Customizations
  • Continuity
  • Write code
  • Enterprise
  • Extensibility
  • Release notes
  • Blog
  • Documentation
  • Learn
  • API
  • FAQ
  • Extension Marketplace (opens in new tab)

This view

  • Original page
  • New address

GeezerVison is showing code.visualstudio.com — Glob Patterns Reference

Glob Patterns Reference

  • View as Markdown
  • Ask in VS Code
  • Ask in VS Code Insiders

Visual Studio Code uses glob patterns in many components. Examples include setting file and folder includes/excludes in features such as Search, hiding files from the File Explorer or marking them readonly, and setting up programming language-specific file associations.

Glob pattern syntax

VS Code supports the following glob syntax:

  • / to separate path segments
  • * 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 (for example {**/*.html,**/*.txt} matches all HTML and text files)
  • [] to declare a range of characters to match (example.[0-9] to match on example.0, example.1, …)
  • [!...] to negate a range of characters to match (example.[!0-9] to match on example.a, example.b, but not example.0)

Note: Paths are separated by / and not \ even on Windows. But when applied, glob patterns will match paths with both slash and backslashes.

Case sensitivity

Glob pattern matching behavior differs based on the platform's file system:

  • Windows and macOS: Glob patterns are case-insensitive by default. For example, the pattern **/MyFolder/** will match myfolder/, MyFolder/, MYFOLDER/, and any other case variation.
  • Linux: Glob patterns are case-sensitive. The pattern **/MyFolder/** will only match folders with that exact casing.

This platform-aware behavior applies to all uses of glob patterns in VS Code, including:

  • Search view include/exclude patterns
  • files.exclude Open in VS Code Open in VS Code Insiders setting
  • search.exclude Open in VS Code Open in VS Code Insiders setting
  • .gitignore file patterns (when explorer.excludeGitIgnore Open in VS Code Open in VS Code Insiders is enabled)
  • Search Editor patterns

For example, if you have a .gitignore file with a pattern like build/, this will match build/, Build/, BUILD/, and other case variations on Windows and macOS, but only exact matches on Linux. This ensures consistent behavior with how these file systems handle file and folder names.

Remote development: When working with remote workspaces (such as WSL, SSH, or dev containers), the glob matching behavior follows the remote file system's case sensitivity rules, not the local client's operating system.

Special cases

Glob patterns in the Search view work differently than in settings such as files.exclude Open in VS Code Open in VS Code Insiders and search.exclude Open in VS Code Open in VS Code Insiders . In the settings, you must use **/example to match a folder named example in subfolder folder1/example in your workspace. In the Search view, the ** prefix is assumed. The glob patterns in these settings are always evaluated relative to the path of the workspace folder.

Exclude exceptions

To keep selected files or folders visible or searchable when another pattern excludes them, prefix a pattern with ! in files.exclude Open in VS Code Open in VS Code Insiders or search.exclude Open in VS Code Open in VS Code Insiders . Add the exception to your settings.json file. For example:

{
  "files.exclude": {
    "node_modules": true,
    "!node_modules/@types": true
  }
}

This configuration hides the root node_modules folder except for @types and its contents. The Explorer shows the parent folders needed to reach matching files. The exception also includes these files in Search and Quick Open, even if search.exclude Open in VS Code Open in VS Code Insiders or .gitignore would otherwise exclude them.

Exceptions in search.exclude Open in VS Code Open in VS Code Insiders affect Search and Quick Open without changing Explorer visibility.

The following rules apply to exceptions:

  • Patterns are relative to each workspace folder. For example, !node_modules/@types matches only at the workspace root, while !**/node_modules/@types also matches nested folders. Absolute exception paths are ignored.
  • An exception includes matching files or folders and everything inside matching folders. Exceptions override exclude patterns and .gitignore, regardless of pattern order. You cannot exclude files again inside a folder that matches an exception.
  • Set an exception to false to turn it off. Setting a regular exclude pattern to false only turns off that pattern. It does not restore files hidden by a different pattern or .gitignore.
  • Exceptions only restore excluded files. An exception on its own does not hide any files.
  • Version control folders such as .git, .svn, .hg, and .jj stay excluded unless an exception explicitly names them, such as !.git/hooks.
  • This syntax applies only to files.exclude Open in VS Code Open in VS Code Insiders and search.exclude Open in VS Code Open in VS Code Insiders , not to the Search view's files to exclude input box or other glob-based settings.
Note

Prefer exceptions with a specific folder path. Exceptions that start with ** require Search to traverse the whole workspace folder, including ignored folders, and can slow searches. In the Explorer, they can also show additional folders that might contain a match.

Exceptions are not yet supported by extension-provided search providers, such as those used in some virtual workspaces.

Common questions

Why do glob patterns not support feature X or Y?

We implemented our own glob matching library with a goal to provide optimal performance for most typical patterns. If you expect a certain glob syntax to be supported, you can report an issue with your usecase.

Why does my glob pattern not work?

Make sure that on Windows you are using / to separate paths and not \. Glob patterns in VS Code require / for separating paths but they will both match on / and \ in paths.

If you're trying to literally match a special character like [ or ], escape it by placing the special character inside square brackets (single-character range) to avoid it being interpreted in pattern matching. Backslashes do not escape them. For example, to match files under src/routes/post/[id]/, you would use the pattern src/routes/post/[[]id[]]/**.

11/11/2026
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.