# Search and Replace

> Editor42 Search and Replace plugin — provides find-and-replace functionality with case-sensitive and whole-word matching.

Source: https://editor42.com/plugins/searchreplace  
Every page of editor42.com has a Markdown copy at its URL + `.md` (`index.md` after a URL that ends in `/`); all of them are in one file: https://editor42.com/llms-full.txt

Plugin alias: `searchreplace`

```js
editor42.init({
  plugins: 'searchreplace'
});
```

Provides find-and-replace functionality through a dialog that supports case-sensitive matching, whole-word matching, and search-within-selection. Matches are highlighted with the class `editor42-m-match-marker`, with the active match additionally receiving `editor42-m-match-marker-selected`.

## Commands

| Command | Description |
|---|---|
| `SearchReplace` | Opens the Find and Replace dialog. |

## Toolbar buttons

| Button | Type | Description |
|---|---|---|
| `searchreplace` | Button | Opens the Find and Replace dialog. |

## Menu items

| Item | Description |
|---|---|
| `searchreplace` | Opens the Find and Replace dialog. |

## API

| Method | Description |
|---|---|
| `find(text, matchCase, wholeWord, inSelection?)` | Finds and marks matches, returns count. |
| `next()` | Moves to next match. |
| `prev()` | Moves to previous match. |
| `replace(text, forward?, all?)` | Replaces current or all matches. |
| `done(keepEditorSelection?)` | Removes all markers, resets state. |

## Keyboard shortcuts

| Shortcut | Action |
|---|---|
| `Ctrl+F` / `Cmd+F` | Opens the Find and Replace dialog. |
