---
title: "replaceFoundTextInRange:inDocument:withText:"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uitextsearching-53wjq/replacefoundtextinrange:indocument:withtext:"
---

# replaceFoundTextInRange:inDocument:withText:

Informs the searchable object to replace the text range for the highlighted search result.

## Declaration

```occ
- (void) replaceFoundTextInRange:(UITextRange *) range inDocument:(UITextSearchDocumentIdentifier) document withText:(NSString *) replacementText;
```

## Parameters

- `range`: The text range to replace.
- `document`: A string that uniquely identifies a document when searching multiple documents, or nil when searching a single document.
- `replacementText`: The string to replace the text with.

## Discussion

Discussion When supportsTextReplacement returns YES, the system calls this method during a find session to request a text range to replace.

## See Also

### Handling replacements

- [supportsTextReplacement](uikit/uitextsearching-53wjq/supportstextreplacement.md)
- [replaceAllOccurrencesOfQueryString:usingOptions:withText:](uikit/uitextsearching-53wjq/replacealloccurrencesofquerystring:usingoptions:withtext:.md)
- [shouldReplaceFoundTextInRange:inDocument:withText:](uikit/uitextsearching-53wjq/shouldreplacefoundtextinrange:indocument:withtext:.md)
