Instead of searching a single file, Texifier’s text search in a project workspace allows you to search all of its documents simultaneously. The starting point of this search is the Text Search sub-pane in the search section
Searching
Simple Text Search
Simply type a term you wish to search in the search field and press the Enter key, or the Search button to start the search. Any results found will be listed in a table below the search field. For a large document, this may take some time, especially when performing regex searches, and the results will be added as they are found.
The search results in the table are collated per file making it easier to see the usage of a search term in each subfile of the project. Clicking or tapping on a row will navigate to the corresponding line in the editor.
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. We will not cover in this article details of what Regular expressions are, but the Wikipedia page is a good place to start.
You can place the text search in Texifier into the regex mode by selecting the option Treat search term as a regex from the search options menu (see below). Any term entered in this mode will be treated as a regex pattern during the search. 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, Texifier’s Regular Expression engine is based on icucore
, so it uses classical Unix syntax for Regular Expressions.
Replacement
Simple Text 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 Replacement
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.
Search Options Menu
The options menu may be shown by clicking on the little arrow that follows the search icon
The options are as follows,
Case Sensitivity
The text search may be carried out in a case-sensitive or case-insensitive way by toggling the option
The Regex Mode
You may carry out the search in the regex mode by selecting
.Recent Searches
Your recent search terms are listed in the options menu and may be cleared at any time.
Keyboard Navigation
The text search 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. and (the up/down arrow keys on your keyboard): 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.