Skip to content

Instantly share code, notes, and snippets.

@thedavidyoungblood
Last active November 5, 2025 18:08
Show Gist options
  • Select an option

  • Save thedavidyoungblood/ad0155ea75b2c12bd3fe3d682fc65e3c to your computer and use it in GitHub Desktop.

Select an option

Save thedavidyoungblood/ad0155ea75b2c12bd3fe3d682fc65e3c to your computer and use it in GitHub Desktop.
IDE-SEARCH-GLOB-and-REGEX_cheatsheet.md

VS Code / Cursor / IDE - Search QRG (Glob + Regex)

Mental model:

  • Search text box = regex capable (if you toggle “Use Regular Expression”).
  • files to include / files to exclude = glob patterns (not regex).
  • By default, VS Code respects .gitignore and your search.exclude / files.exclude settings if “Use Exclude Settings and Ignore Files” is on.

1) Glob patterns (for files to include/exclude)

Operators

  • * – any chars except / (one path segment)
  • ** – any depth (can cross /)
  • ? – any single char
  • {a,b,c} – OR group (choose one)
  • [abc] / [a-z] – character class (rarely needed)
  • / – path separator (match folders)
  • (Optional) !pattern – negate a pattern. Works in many VS Code glob contexts; if it doesn’t behave as you expect in your version/extension, prefer explicit include or put the pattern in Exclude.

Path roots

  • Patterns are workspace-root relative.
  • In multi-root workspaces, prefix with the folder name: my-app/**.

Common recipes

# Only search a folder (and below)
folder/**

# Only certain file types
**/*.ts
src/**/*.{js,ts,tsx}
**/*.{md,mdx}

# Exclude heavyweight dirs (put in Exclude or settings)
**/{node_modules,dist,build,coverage,.next,.turbo}/**

# Exclude minified or generated files
**/*.min.*            # e.g. .min.js, .min.css
**/*.map              # sourcemaps

# Include multiple roots
{src,packages,apps}/**   # OR-group

# Include everything but a folder (if negation supported)
**,!**/node_modules/**

Tip: Most of the time, the simplest thing is to constrain with “files to include” (e.g., src/**) and leave Exclude blank.


2) Text matching (the main search box)

Toggle Use Regular Expression to enable regex on the search text itself.

Regex essentials

  • Literals: foo, foo\.ts

  • Any char: .

  • Start/End of line: ^ / $

  • Quantifiers: a? (0–1), a* (0+), a+ (1+), a{2,5} (2–5)

  • Groups: (foo), non-capture (?:foo)

  • OR: foo|bar

  • Character classes: [abc], [a-zA-Z0-9_], \d, \s, \w

  • Word boundary: \b

  • Lookarounds (VS Code supports PCRE-style):

    • (?=...) positive lookahead
    • (?!...) negative lookahead
    • (?<=...) positive lookbehind
    • (?<!...) negative lookbehind
  • Multiline option is effectively per-line; use \n if you “Find in Files” across lines.

  • In Replace, you can use captures: $1, $2, …

Examples

# Find function definitions named getUser
^\s*(export\s+)?function\s+getUser\b

# Find TODOs not assigned to anyone
TODO(?!\s*@\w+)

# Match import lines pulling default + named members
^import\s+\w+\s*,\s*{[^}]+}\s+from\s+['"][^'"]+['"];

3) Putting it together (fast “how do I…”)

Only search one folder

  • Files to include: folder/**
  • Exclude: (leave empty)

Search only JS/TS across monorepo packages

  • Include: packages/**/{src,lib}/**/*.{js,ts,tsx}

Search everything except certain dirs

  • Include: **
  • Exclude: **/{node_modules,dist,build,coverage}/**

Search docs only

  • Include: **/*.{md,mdx}

Search all but minified & maps

  • Include: **/*.{js,css}
  • Exclude: **/*.min.*, **/*.map

Temporarily “un-ignore” a folder that’s in .gitignore

  • Make sure “Use Exclude Settings and Ignore Files” is on (default).
  • Then explicitly include the folder: apps/my-tool/** (Include field wins).

4) Settings you’ll use a lot

Workspace → .vscode/settings.json

{
  // Hide files from Explorer & most operations
  "files.exclude": {
    "**/.DS_Store": true,
    "**/node_modules": true,
    "**/dist": true,
    "**/build": true
  },

  // Exclude from Search (can still override via Include field)
  "search.exclude": {
    "**/node_modules": true,
    "**/dist": true,
    "**/build": true,
    "**/.next": true,
    "**/.turbo": true,
    "**/coverage": true
  },

  // If you want .gitignore to affect Search
  "search.useIgnoreFiles": true
}

Quick UI toggles in the Search panel:

  • Use Regular Expression → affects the text you’re searching for
  • Match Case / Match Whole Word → also for text
  • Use Exclude Settings and Ignore Files → whether to honor .gitignore, search.exclude, files.exclude

5) Gotchas & Tips

  • Glob ≠ regex: file filters are glob patterns; only the text box is regex.
  • Case sensitivity: path matching follows the OS (case-insensitive on Windows/macOS, case-sensitive on Linux).
  • Multi-root workspaces: prefix with the folder name to target a specific root.
  • Right-click speedrun: In Explorer, right-click a folder → Find in Folder… auto-fills the Include field.
  • Negation (!): supported in many glob contexts, but behavior can vary with extensions. If a ! pattern isn’t honored, list the unwanted paths in Exclude or search.exclude.

6) Copy-paste mini cookbook

# Only one folder
my-folder/**

# Only source + tests
{src,test}/**

# Only JS/TS in src and packages
{src,packages}/**/*.{js,jsx,ts,tsx}

# Everything except build outputs
**                     # Include
**/{node_modules,dist,build,coverage}/**   # Exclude

# Docs only
**/*.{md,mdx}

# No minified or maps
**                     # Include
**/*.min.*, **/*.map   # Exclude


/#END-OF-FILE!



[!NOTE] ### NOTE:

This is just provided as conceptual research, documentation, for informational-purposes only, etc., and has not been fully battle tested or vetted, however would appreciate hearing and learning about any implementations, and shared learnings. (Unless otherwise explicitly stated by the author.)


@TheDavidYoungblood

🤝 Let's Connect!

LinkedIn // GitHub // Medium // Twitter/X



A bit about David Youngblood...


David is a Partner, Father, Student, and Teacher, embodying the essence of a true polyoptic polymath and problem solver. As a Generative AI Prompt Engineer, Language Programmer, Context-Architect, and Artist, David seamlessly integrates technology, creativity, and strategic thinking to co-create systems of enablement and allowance that enhance experiences for everyone.

As a serial autodidact, David thrives on continuous learning and intellectual growth, constantly expanding his knowledge across diverse fields. His multifaceted career spans technology, sales, and the creative arts, showcasing his adaptability and relentless pursuit of excellence. At LouminAI Labs, David leads research initiatives that bridge the gap between advanced AI technologies and practical, impactful applications.

David's philosophy is rooted in thoughtful introspection and practical advice, guiding individuals to navigate the complexities of the digital age with self-awareness and intentionality. He passionately advocates for filtering out digital noise to focus on meaningful relationships, personal growth, and principled living. His work reflects a deep commitment to balance, resilience, and continuous improvement, inspiring others to live purposefully and authentically.


Personal Insights

David believes in the power of collaboration and principled responsibility in leveraging AI for the greater good. He challenges the status quo, inspired by the spirit of the "crazy ones" who push humanity forward. His commitment to meritocracy, excellence, and intelligence drives his approach to both personal and professional endeavors.

"Here’s to the crazy ones, the misfits, the rebels, the troublemakers, the round pegs in the square holes… the ones who see things differently; they’re not fond of rules, and they have no respect for the status quo… They push the human race forward, and while some may see them as the crazy ones, we see genius, because the people who are crazy enough to think that they can change the world, are the ones who do." — Apple, 1997


My Self-Q&A: A Work in Progress

Why I Exist? To experience life in every way, at every moment. To "BE".

What I Love to Do While Existing? Co-creating here, in our collective, combined, and interoperably shared experience.

How Do I Choose to Experience My Existence? I choose to do what I love. I love to co-create systems of enablement and allowance that help enhance anyone's experience.

Who Do I Love Creating for and With? Everyone of YOU! I seek to observe and appreciate the creativity and experiences made by, for, and from each of us.

When & Where Does All of This Take Place? Everywhere, in every moment, of every day. It's a very fulfilling place to be... I'm learning to be better about observing it as it occurs.

A Bit More...

I've learned a few overarching principles that now govern most of my day-to-day decision-making when it comes to how I choose to invest my time and who I choose to share it with:

  • Work/Life/Sleep (Health) Balance: Family first; does your schedule agree?
  • Love What You Do, and Do What You Love: If you have what you hold, what are YOU holding on to?
  • Response Over Reaction: Take pause and choose how to respond from the center, rather than simply react from habit, instinct, or emotion.
  • Progress Over Perfection: One of the greatest inhibitors of growth.
  • Inspired by "7 Habits of Highly Effective People": Integrating Covey’s principles into daily life.

Final Thoughts

David is dedicated to fostering meaningful connections and intentional living, leveraging his diverse skill set to make a positive impact in the world. Whether through his technical expertise, creative artistry, or philosophical insights, he strives to empower others to live their best lives by focusing on what truly matters.

David Youngblood

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment