Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Search for multiple strings in several files with Sublime 3

I know how to search for a single string in several files at once with Sublime 3 (explained here).

What I need to do is to search for multiple strings in several files. I've tried going to Find in files and setting:

Field:  string1 \& string2 Where: /path_to_folder_containing_the_files_I_want_to_ search/ 

(where string1 and string2 are the strings I want to search for) but that doesn't seem to work.

Can this be done at all?

like image 981
Gabriel Avatar asked Sep 05 '14 15:09

Gabriel


People also ask

How do I search all files in Sublime Text?

Use the Search all shortcut: Ctrl + Shift + F , then select the folder in the "Where:" box below. (And for Mac, it's ⌘ + Shift + F ).

How do I select multiple files in Sublime Text?

Multiple Selections To select multiple regions using the keyboard, select a block of text, then press Ctrl+Shift+L to split it into one selection per line. When you're done with using multiple selections, just press Ctrl+K to trim all but the first.


1 Answers

Just came across this old question and thought I'd add my solution, which may be useful for somebody in the future.

Sublime supports searching in all open folders and can use regex. So utilizing both, you can open or add all folders you want to search in to the project and use regex to search for multiple keywords. In your case it would be the following (make sure to check the regex box .* icon):

Find: (string1|string2) Where: <open folders> 
like image 137
Sherzod Avatar answered Sep 22 '22 05:09

Sherzod