---
title: "replace(_:)"
framework: browserenginekit
role: symbol
role_heading: Instance Method
path: "browserenginekit/berespondereditactions/replace(_:)"
---

# replace(_:)

Removes the selected text and inputs the chosen replacement text.

## Declaration

```swift
optional func replace(_ sender: Any?)
```

## Parameters

- `sender`: The object calling this method.

## Discussion

Discussion To invoke the standard system behavior for replacing text, call textInput(_:deferReplaceTextActionToSystem:) in your implementation of this method.

## See Also

### Finding and replacing text

- [findSelected(_:)](browserenginekit/berespondereditactions/findselected(_:).md)
- [promptForReplace(_:)](browserenginekit/berespondereditactions/promptforreplace(_:).md)
- [addShortcut(_:)](browserenginekit/berespondereditactions/addshortcut(_:).md)
