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

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 of the Sidebar. You can also quickly bring this pane up by pressing the key combination Cmd-Shift-F on both Texifier macOS and iOS.

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.

The Windows variant of this article will be updated in due course. To try out Texifier for Windows before it is publicly released, please sign up for a beta.