--- description: Choose docked or pop-out search, select document and title scopes, replace individual or multiple matches, and search with regular expressions. --- # Find and Replace Press Ctrl + F (⌘ + F on macOS) to open search. Two interfaces are available: | Mode | Best for | | --- | --- | | **Pop-Out Search** | Finding and replacing text across multiple documents, with matches from the selected scope listed together | | **Docked Search** | Finding and replacing text in the current document, with matches highlighted directly in the body text | ## Switch Between Search Modes **From docked to pop-out search:** click **Pop Out** on the right of the search bar below the editor. Search opens in a separate window. ![Pop Out button on the right of the docked search bar](/assets/switch-to-floating%402x.B-fssY4R.png) **From pop-out to docked search:** click **Dock** at the top right of the search window. The search bar returns to the bottom of the main-window editor. ![Dock button at the top right of pop-out search](/assets/switch-to-docked%402x.Cia9n6wp.png) WonderPen remembers your search interface. Switching preserves the search term, replacement, regular expression and case settings. Check the scope and results again after switching. ## Pop-Out Search Enter a keyword to see matching documents and context. Click a result to locate it, or use the arrows at the bottom to move between results. ![Documents and matches in pop-out search](/assets/search-01%402x.yaTEL4Jg.png) Enter the new text in **Replace to**, select a result and click **Replace**, or use **Replace All** for all editable matches in the current scope. An empty replacement deletes the matched text. ![The search window shows “ferry” as the search term, “landing” as the replacement, matching passages, and the replacement buttons](/assets/search-03%402x.KyBLw85R.png) Check the scope and results before a bulk replacement. Consider [creating a snapshot](./snapshot.md) of important content first. If the app reports incomplete results or a failed replacement, search again to check what actually changed. The dropdown controls beside the search and replacement inputs show previous entries for reuse. ### Search Titles Only Enable **Title Only** to search and replace chapter names. With [automatic numbering](./auto-n.md), searches also match displayed numbers. Generated numbers cannot be replaced directly; change the numbering rule or the document order instead. ![Title Only option and matching chapter names](/assets/title-only%402x.Cjd8X5I7.png) ### Search Scope The three icon buttons on the right of the **Scope** row determine which documents to search and replace in. ![All documents, Current document and Custom buttons on the right of the Scope row](/assets/scope-buttons%402x.CjkTgvSw.png) From left to right: | Button | Search scope | Example use | | --- | --- | --- | | **All documents** (book icon) | All documents in the current Library | Find a character's name throughout a book or change a term consistently | | **Current document** (page icon) | The document or documents selected in the main-window document tree; the scope follows changes to the selection | Check only the chapter you are working on | | **Custom** (checked box icon) | Documents you select from the list | Search or replace in a specific set of chapters | To choose a custom scope, click the scope label in this row to open the document list, then select the documents you need. Changing the selection automatically activates **Custom**. The list starts with the main tree’s expanded and collapsed branches and scrolls to the location of the first selected item. Use **Expand All** and **Collapse All** to browse branches. Collapsing a branch preserves the selected documents. ![Document tree with the expand and collapse buttons highlighted in the custom search scope](/assets/search-04%402x.BSDoctJ3.png) The active scope button is highlighted. Before using **Replace All**, check the scope label and matching results to confirm that all intended chapters are included and no unintended content will change. ## Docked Search Docked search appears below the editor and highlights matches in the current document. Enter replacement text to replace matches individually or replace all matches in that document. With matches present, **Next** wraps from the last match to the first, and **Previous** wraps in the opposite direction. When the selection covers a match exactly, **6 of 11 matches** means the sixth occurrence in the document body is selected. Moving the cursor away leaves just the total. In a narrow pane, hover over the arrows and option icons to identify them. ![Highlighted text above the narrow search bar, with the navigation arrows and match counter outlined](/assets/search-02%402x.DopHsWAQ.png) The gear beside **Case-Sensitive** controls whether to search memos and filter the document tree. Replacements in the docked panel apply only to the current document body. ![“Earth” highlighted in the editor, with the docked search bar and its gear menu for searching memos and the document tree](/assets/search-05%402x.zhgZAIFh.png) ## Regular Expression A plain-text search looks for the characters you enter. Both search interfaces support **Regular Expression** and **Case-Sensitive**. By default, a search for `May` also finds `may`. Enable **Case-Sensitive** to match the capitalization you entered. For example, `ferr.` highlights “ferry” in “ferryman” and “ferri” in “ferries”. The dot matches any single character except a line break. ![Matches for a regular expression](/assets/search_03%402x.0Jx5B2Of.png) In docked search, enable **Regular Expression** below the search input to highlight matching text directly in the document: ![Highlighted matches in the editor with the Regular Expression checkbox outlined in the search bar](/assets/regexp-docked%402x.BRCL4lQH.png) Expressions use JavaScript syntax; do not add surrounding `/` delimiters: | Expression | Finds | | --- | --- | | `m.*?y` | The shortest text from `m` to `y` without crossing a line break | | `\d+` | A sequence of digits | | `\[\d+\]` | A reference number such as `[276]` | | `[ \t]{2,}` | Two or more consecutive spaces or tabs | Check matches before replacing with an unfamiliar pattern. If an expression is invalid, correct it before attempting a bulk replacement.