Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Search for all files *not* containing a string in VS Code

Tags:

In Visual Studio Code, using the search capability, how can I search for all files that do not contain a certain string? In this case - "OnPush"

like image 894
Craig Smitham Avatar asked Jul 11 '18 23:07

Craig Smitham


People also ask

How do I search for a string in all files in Visual Studio code?

VS Code allows you to quickly search over all files in the currently opened folder. Press Ctrl+Shift+F and enter your search term. Search results are grouped into files containing the search term, with an indication of the hits in each file and its location.

How do I search all files in Visual Studio?

In Visual Studio 2022 and later, you can set Visual Studio to always keep results. Go to Tools > Options > General > Find and Replace, and select the checkbox for Keep search results by default.

Can you use regex in Vscode search?

Vscode has a nice feature when using the search tool, it can search using regular expressions. You can click cmd+f (on a Mac, or ctrl+f on windows) to open the search tool, and then click cmd+option+r to enable regex search. Using this, you can find duplicate consecutive words easily in any document.

How do I search all open files in VS code?

The best way to find something you are searching for within a specific file in vs code would be: Ctrl + p then pressing @ on the search bar.


1 Answers

In general regex, to search for anything that does not contain a certain string, you do stringbefore(?!string) That is a negative lookahead, it says that only match if whatever you specify as string is not present. In your case it would be something like [\W\w]+(?!OnPush)

But, Negative Lookaheads aren't supported in VS Code Search... So you can't do much.

like image 77
Sheshank S. Avatar answered Sep 25 '22 20:09

Sheshank S.