Text search (and replace) across the project
This article concerns the
macOS
app.
See other variants:
iOS
Windows

Global search allows you search all documents in a workspace simultaneously.

macos/text-search-field.png

Getting started

Press Cmd-Shift- F or click in the search box on the toolbar to start a search. Once you have typed more than 2 characters of your search term, the search will start and a popover will appear with results as they are found. For a large document, this may take some time, especially when performing regex searches, and the results will be added as they are found.

macos/text-search.png

Regex Search

Some users may be familiar with Regular Expressions, often referred to as regexes. This is a special syntax for constructing complex text searches. This is not an introduction to Regular expressions, the Wikipedia page is a good place to start.

If you want to search by Regular Expression in Texpad, to start with, using the little arrow in the search text field, select the option Treat search term as a regex to switch to the regular expressions. For example, to search for the regular expression string\s+theory, type it into the search box. Please note that applying complex regular expressions to a large document can take some time to return all results.

NB Texpad’s Regular Expression engine is based on icucore, so it uses classical Unix syntax for Regular Expressions.

Replacement

Once your results are displayed, you may want to replace some of them. To do this, type some replacement text in the box at the bottom of the search popover.

Select a result and press the Replace button to replace just that search result.

Press Replace All to replace all search results.

Please note that before any result is replaced, it will be compared to the original search term. It will only be replaced if it matches the original search term.

Regex Replace

A useful feature of regular expressions is to capture groups. For example the regular expression how (\w+) you applied to how are you would capture are as group 1.

When replacing regex searches, you can insert group 1,2,3, etc. into the replacement string with $1, $2, $3, etc. So if you were to search for how (\w+) you and replace with where $1 you?, then how are you would become where are you?, how were you would become where were you? and so on.

Keyboard Navigation

The search window is designed to be fully navigable via the keyboard.

  • Cmd-Shift- F: open the global search window
  • - Esc: close the global search popover without clearing it, this allows you to press Cmd-Shift- F to return to where you started.
  • - &#8593, &#8595: The up and down arrows let you navigate the global search results.
  • - Enter: Press enter on a global search result to close the window and jump to that result in the text.