To search (and replace) within a script, you’ll use the find bar and the Search menu.
To summon the find bar:
To dismiss the find bar:
Click Done in the find bar.
Or, press Esc.
To configure a search in the find bar, use the checkboxes:
RegEx. If checked, the search string (and replace string) will be interpreted as a regular expression. Script Debugger uses the ICU flavor of regular expression syntax.
By default,
.
doesn’t match the return character at the end of a line; you can reverse this with the(?s)
flag.
Match Word. If checked, the search string is sought between word boundaries.
Ignore Case. If checked, the search is case-insensitive.
Wrap. If checked, successive Find Again commands loop around the document. If unchecked, Replace All affects text only after the start of the current selection.
To perform a search:
The search is initially performed automatically as you edit the search string.
To search forward or backward, choose Search > Find Again (Backwards), or click the arrow buttons in the find bar.
The Wrap checkbox affects the behavior of this command.
To perform a search-and-replace:
Click the & Replace
button to reveal the replace string and Replace buttons.
Click a Replace button or choose a Replace command from the Search menu.
The Wrap checkbox affects the behavior of Replace All (and Replace & Find).
You can use selected text as the search or replace term; choose Search > Find Selection (Backwards) or Use Selection for Find/Replace.
To recall a recent search, click the magnifying-glass icon in the search field.
An Editor preference, “Share Find string with other applications,” determines whether the search string is shared with the system-wide Find pasteboard.