The Basics
Before turning to GREP expressions, it may be useful to outline the interface, which is shown in the screenshot in Figure 2. GREP's dialog is similar to the Text dialog, and virtually everything said here about GREP's dialog also holds for the Text dialog. (Indeed, the dialogs are so similar that more than once you will utter #+*?$ before trying to match it using the GREP dialog. Be prepared.) The GREP dialog has several components, marked A to G in Figure 2. We'll deal with them in turn.

Figure 2. The GREP tab of the Find/Change dialog box
Everything you enter in the dialog (the "query") can be saved to disk for future use: search and replace strings, whether or not footnotes should be included, formatting settings—all these things are stored and reinstated when a saved query is retrieved later. To save a query, press
and enter a name.Here you enter what you want to search for. This field accepts text, including GREP codes, though these can also be entered using a menu. Press
to access it. The menu is shown in Figure 2. For the purposes of GREP, the last two sections in the menu are relevant (from Wildcards to Posix), and we'll deal with them extensively in this Short Cut. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access