Combining Searches
Combining searches finds lines by more than one pattern. For example, you can find the lines that contain ERROR and timeout but not retry. You run each search on its own, add it to a chain with an operator, and then run the chain. The result is a set of lines that opens in Grep view.
The chain is in the Combine searches section of the search panel, below the status line. The section appears after you run a text search, and shows the number of searches in the chain, for example Combine searches (2). Select the heading to show or hide the chain.
Build a chain
Section titled “Build a chain”This example finds the lines that contain ERROR and timeout but not retry.
-
Open the search panel with
Ctrl + F, search forERROR, and wait for the search to finish. -
In the Combine searches section, select Add current. The search becomes the first row of the chain.
-
Search for
timeout. Leave the operator next to Add current set to AND, and select Add current. -
Search for
retry. Set the operator to NOT, and select Add current. -
Select Run chain.
You can also press Ctrl + Shift + A in Text view to add the current search to the chain with AND.
Each row shows its position, its operator, the search pattern, the number of matches the search found (for example 120 hits), and a button that removes it from the chain. You can change a row’s operator at any time before you run the chain.
Only finished text and regular expression searches can be added. Hex byte and strings searches cannot. Vaste refuses a search that is already in the chain with That search is already in the chain.
How the operators work
Section titled “How the operators work”Vaste reads the chain from top to bottom. It starts with the lines that match the first search, then applies each row’s operator with the lines of that row’s search:
| Operator | Keeps |
|---|---|
| AND | Lines in the result so far that also match this search |
| OR | Lines in the result so far, plus the lines that match this search |
| NOT | Lines in the result so far that do not match this search |
Operators combine lines, not matches. A line with ERROR at the start and timeout at the end matches ERROR AND timeout.
Vaste applies the rows in order, without operator precedence: A OR B AND C keeps the lines that match A or B, and then keeps only those that also match C. The rows stay in the order you added them and cannot be moved, so add the searches in the order you want them applied.
Start with NOT
Section titled “Start with NOT”The first row has no operator to combine with, so its menu offers start and NOT. Set it to NOT to start from every line that does not match the first search. For example, NOT DEBUG AND user=alice finds the lines for user=alice that are not debug lines.
Run the chain
Section titled “Run the chain”Select Run chain. While it runs, the button shows Combining…. When it finishes:
- The status line shows the number of lines and the chain, for example 42 lines match ERROR AND timeout NOT retry in 15 ms.
- Grep view opens and shows the lines with context. See Grep view.
- If no line matches, Vaste shows No lines match the chain.
The results list and the highlights come from the AND and OR searches, on the lines that remain, up to 10,000 matches. NOT searches add no highlights. A chain made only of NOT rows therefore lists no matches in the results list, but its lines still appear in Grep view.
Use the result
Section titled “Use the result”The result of a chain works like the result of a search:
- Copy and Export… copy or save every line of the result. See Copy or export matching lines.
- Pin keeps a snapshot of it. See Pinned results.
- Add current adds the whole result to the chain as one row, shown in parentheses. Use this to group operators: to get
(A OR B) AND C, run the chainA OR B, remove its two rows, add the result, then search for C and add it with AND.
The result of a chain cannot be saved as a filter.
Change or clear the chain
Section titled “Change or clear the chain”To remove a search, select the remove button on its row. If you remove the first row, the next row becomes first, and a NOT on that row then means “every line that does not match”.
The chain belongs to the open file. Vaste clears it when you:
- Reload the file, including an automatic reload.
- Reopen the file with another encoding.
- Close the file or open another file.
Vaste keeps the results of up to 100 finished searches. When it has 100, each new search replaces one of the kept results, not always the oldest. If you run many searches after building a chain, a search in the chain can expire, and Run chain shows an error that starts with Combine failed: Search results not found. Run that search again, remove the old row, and add the new search.
Next steps
Section titled “Next steps”- Grep view: read the combined lines with context
- Saved filters and alerts: save the searches you combine often