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"
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.
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With