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 insensitive.
If checked, the search will only match if there is a word boundary at both ends of the string matching, meaning not an alphanumeric character - either some other visible character or a line end.
If checked, the search will start at cursor position, otherwise it will start at the beginning of the first line in the document.
If checked, the search will look for the first match above the starting point, either cursor position or the beginning of the document, if the From Beginning option is enabled.
The Replace Text Dialog offers some additional options:
This is where to enter the replacement string.
This option is disabled if no text is selected, or if the Prompt on Replace option is enabled. If checked, all matches of the search string within the selected text will be replaced with the replace string.
If checked, a small dialog will prompt you for what to do for each time a match is found. It offers the following options:
Activate this to replace the current match (which is selected in the editor).
Activate to skip the current match, and try to find another one.
Activate to cancel prompting, and just replace all matches.
Activate this to skip the current match and end the searching.
There is currently no way to use minimal matching when searching for a regular expression. This will be added in a future version of Kate
To find text, launch the Find Text Dialog with Ctrl+For from the -> menu item, enter a search string, set the options as desired and hit . If the search was started at cursor position and no match was found before reaching the end (or beginning if you are searching backward) of the document, you will be asked if you want to wrap the search.
If a match is found it is selected and the Find Text Dialog is hidden, but stay tuned, 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 wrap the search.
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 (if the replace string is empty, each match will be removed), set the options as desired and hit the button.
If you are using a regular expression to find the text to replace, you can employ backreferences to reuse text captured in parenthesized subpatterns of the expression.
See Appendix B, Regular Expressions for more on those.
You can do find, replace and ifind (incremental search) from the command line.
Would you like to make a comment or contribute an update to this page?
Send feedback to the KDE Docs Team