Search, Find & Replace Across Files
VS Code's search capabilities are fast and flexible. From quick in-file find to full regex workspace search with preview, this lesson covers every search scenario.
1Find in the Current File
Press Ctrl+F to open the Find widget. Features include: case-sensitive toggle, whole-word match, and regular expressions. Use F3 / Shift+F3 to cycle through matches. Press Alt+Enter to select all matches at once for multi-cursor editing.
2Find & Replace in File
Press Ctrl+H to open Find & Replace. Type your search term, then the replacement. Use Ctrl+Alt+Enter to replace all. Tick the regex button (Alt+R) to use capture groups: ($1) style replacements.
Find: function (\w+)\( Replace: const $1 = (
3Workspace-Wide Search
Press Ctrl+Shift+F to search across your entire workspace. Results appear grouped by file with full context lines. Click any result to jump to it. Use the include/exclude boxes to target specific file globs:
Include: src/**/*.ts Exclude: **/node_modules, **/dist
4Workspace-Wide Replace
Switch to the Replace panel inside the Search sidebar. Preview all changes before applying — each file shows a diff of what will change. Replace file-by-file or all at once.
5Search Editors
Open a Search Editor (Ctrl+Shift+P → Search Editor: Open New) to get a full-size, persistent view of search results. You can edit results directly in the search editor and save the search for later. Great for large refactoring sessions.