Glob Pattern Samples

Glob pattern examples for file matching from basic to complex patterns

📝 Simple Wildcard Pattern

🟢 simple

Basic pattern using * to match any characters

🏷️ glob, pattern, wildcard, file-matching, basic
*.txt

📝 File Extension Match

🟢 simple

Match files with multiple extensions

🏷️ glob, pattern, wildcard, file-matching, extension, basic
*.{js,ts,jsx,tsx}

📝 Directory Pattern

🟢 simple

Match files in a specific directory

🏷️ glob, pattern, wildcard, file-matching, directory, basic
src/*.ts

📝 Nested Directories

🟡 intermediate

Match files in nested directory structure

🏷️ glob, pattern, wildcard, file-matching, directory, intermediate
src/components/*.tsx

📝 Recursive Pattern (Globstar)

🟡 intermediate

Match files recursively using ** pattern

🏷️ glob, pattern, wildcard, file-matching, recursive, intermediate
src/**/*.ts

📝 Complex Recursive Pattern

🟡 intermediate

Deep nested pattern with multiple wildcards

🏷️ glob, pattern, wildcard, file-matching, recursive, intermediate
**/*.{test,spec}.{js,ts}

📝 Character Class Pattern

🟡 intermediate

Using character classes [abc] for precise matching

🏷️ glob, pattern, wildcard, file-matching, character-class, intermediate
src/[A-Z]*.ts

📝 Brace Expansion

🟡 intermediate

Using {a,b,c} for multiple alternatives

🏷️ glob, pattern, wildcard, file-matching, brace-expansion, intermediate
src/{components,utils,types}/*.ts

📝 Named Groups Pattern

🟡 intermediate

Pattern for matching numbered/dated files

🏷️ glob, pattern, wildcard, file-matching, numbered, intermediate
logs/app-[0-9]*.log
backup-[0-9][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9].tar.gz

📝 Negation Pattern

🔴 complex

Exclude patterns using ! prefix

🏷️ glob, pattern, wildcard, file-matching, negation, advanced
src/**/*.ts
!**/*.test.ts
!**/*.spec.ts

📝 Comprehensive Project Pattern

🔴 complex

Complex pattern for complete project matching

🏷️ glob, pattern, wildcard, file-matching, comprehensive, advanced
src/**/*.{ts,tsx}
!**/*.test.ts
!**/*.spec.ts
!**/node_modules/**
public/**/*.html
**/*.json

📝 Multiple Ignore Patterns

🔴 complex

Common patterns for build tools and gitignore

🏷️ glob, pattern, wildcard, file-matching, negation, advanced
**/*.ts
!**/*.d.ts
!**/node_modules/**
!**/dist/**
!**/.git/**
**/*.graphql
**/*.gql