The Find and Replace Text dialogs in Kate are very much the same, except the Replace Text dialog offers the means of entering a replacement string along with a few extra options.
The dialogs offer the following common options:
This is where to enter the search string. The interpretation of the string depends on some of the options described below.
If checked, the search string is interpreted as a regular expression. A button for using a graphical tool to create or edit the expression will be enabled.
See Regular Expressions for more on these.
If enabled, the search will be case sensitive.
If checked, the search will only match if there is a word boundary at both ends of the string matching, meaning neither an alphanumeric character, nor some other visible characters, nor a line end.
If checked, the search will start at the current cursor position, otherwise it will start at the beginning of the document.
If checked, the search will look for the first match above the starting point, either the cursor position or the beginning of the document depending on the status of the From cursor option.
This option is not available if no text is selected. If some text has been selected and the option is checked, the search string will be matched only against the selected text.
The Replace Text dialog offers some additional options:
This is where to enter the replacement string.
When regular expressions are enabled, you can select part of the searched text by enclosing it within parenthesis. Placeholders allow you to insert such text in the replacement string, similar to how backreferences are used in sed. When enabled, any occurrence of \N (where N is an integer number, e.g. \1, \2, ...) will be replaced with the corresponding string capture (parenthesized substring) from the search pattern. A button for listing all available string captures will also be enabled. You can click on any of the available string captures to include them in your replacement string.
Placeholders can only be used when searching using regular expressions.
If checked, a small dialog will prompt you for what to do for each time a match is found. It offers the following options:
Use this button to replace the current match, which is selected in the editor. After the replacement, search for the next match automatically.
Use this button to replace the current match, which is selected in the editor. After the replacement, close the dialog.
Use this button to replace all matches without further prompt.
Use this button to skip replacing the current match and try to find the next one.
Use this button to skip replacing the current match and close the dialog.
To find text, launch the Find Text dialog with Ctrl+F or from the -> menu item, enter a search string, set the options as desired and hit the button.
If a match is found it is selected and the Find Text dialog is hidden. Finding further matches is very easy.
To find the next match in the search direction, use the -> command or press F3.
To find the next match in the opposite direction, use the -> command or press Shift+F3.
If no match is found before reaching the document end (or beginning if you are searching backward), you will be asked if you want to continue the search from the other end of the document.
To replace text, launch the Replace Text dialog using the -> command or the Ctrl+R shortcut, enter a search string and optionally a replace string, set the options as desired and hit the button. If the replace string is empty, each match will be removed.
If you are using a regular expression to find the text to replace, you can employ placeholders to reuse text captured in parenthesized subpatterns of the expression.
You can do find, replace and ifind (incremental search) from the editor command line.
To search for text in multiple files at once, please refer to the Find in Files Panel section.
Would you like to comment or contribute an update to this page?
Send feedback to the TDE Development Team