Global search allows you search all documents in a workspace simultaneously.
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,
- Searching for
/state[sd]?/will return instances of state, states and stated.
- 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. Also note that, Texpad’s Regular Expression engine is based on
icucore, so it uses classical Unix syntax for Regular Expressions.
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.
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.
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
$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.
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. - ↑, ↓: 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.