SUMMARY When the search string entered in the "Search and Replace" plugin is a regular expression with lookahead or lookbehind part, the replace functionality does not work. STEPS TO REPRODUCE 1. Open Kate and write a simple text in the editor, for ex: SRC0 SRC1 SRC2 2. Open Search and Replace, enable regular expression search and type the following regex in the search field: SRC(?=\d) 3. Type any replace string in the replace field, for ex: DST 3. Press Search. The found lines will display fine. 4. Press Replace or Replace Checked OBSERVED RESULT The found "SRC" strings are not replaced with "DST" EXPECTED RESULT The found "SRC" strings should be replaced with "DST" SOFTWARE/OS VERSIONS Observed in Kate 21.12.0 for Windows, as well as Kate in the unstable branch of KDE Neon. Qt Version: 5.15.2 (for the Windows version) ADDITIONAL INFORMATION In KWrite (in KDE Neon unstable branch), the above steps work fine.
I can confirm this bug.
A possibly relevant merge request was started @ https://invent.kde.org/utilities/kate/-/merge_requests/587
Git commit cb759994beb24b119492e588147be1916390d017 by Kåre Särs. Committed on 09/02/2022 at 20:14. Pushed by sars into branch 'master'. S&R: Fix Look-ahead & behind highlighting & replace Strip the look-ahead and look-behind from the regular-expression that checks if a string has been modified after search and returns the possible captures. We strip the look-ahead/behind because we only match against the previously found range. M +27 -1 addons/search/MatchModel.cpp M +6 -0 addons/search/MatchModel.h A +48 -0 addons/search/autotest/input/LookaheadLookbehindTestFile.txt A +22 -0 addons/search/autotest/input/MultilineStartEndOfLineMatch.txt M +2 -9 addons/search/plugin_search.cpp https://invent.kde.org/utilities/kate/commit/cb759994beb24b119492e588147be1916390d017