Espresso

Find and Replace

This page is about finding in one document. To search a whole project, see Project find and replace.

Finding

Choose Edit ⟩ Find ⟩ Find… (command F) and the find bar opens above the editor. Type what you are looking for: the matches are marked in the text as you type, and the bar says how many there are.

Move between the matches with the arrows in the bar, or with Edit ⟩ Find ⟩ Find Next (command G) and Find Previous (shift command G). Click Done to close the bar.

To search for text that is already in your document, select it and choose Edit ⟩ Find ⟩ Use Selection for Find (command E), then use Find Next. Jump to Selection (command J) scrolls back to wherever the selection is.

Search options

Four buttons in the find bar change how a search is made:

Replacing

Choose Edit ⟩ Find ⟩ Find and Replace… (option command F) to open the find bar with a second row for the replacement.

Doing more with the matches

Recent and saved searches

Click the magnifying glass in the search field for a menu of your recent searches. To keep a search, choose Save Search… from the same menu and give it a name. A saved search remembers its options and what it replaces with, and is listed under the magnifying glass in every find bar.

Regular expressions

With Regular Expression on, what you type is a pattern, and the parts of a match that you put in parentheses are available in the replacement as $1, $2 and so on, with $0 for the whole match.

If you are new to regular expressions, you might find regular-expressions.info a useful introduction and reference.

Espresso uses the Oniguruma syntax, as Ruby does, which has all the standard features you would expect (capture groups, character classes, lookahead and lookbehind, and so on). For those familiar with other flavors, the main difference is that the option for "dot matches newlines" is m, where most others call it s: (?m) at the start of your expression lets . match a line ending, and (?-m) stops it.