Version: (using KDE KDE 3.5.6) Installed from: SuSE RPMs Today I failed to remove the first space (and only the first space) from all lines containing the space. Given a file with the following contents (replace <space> by the space character) <space>a <space><space>b <space><space><space>c I wanted to get: a <space>b <space><space>c I've used the regular expression "^ " in the find & replace dialog and "" as the new text. Kate removed now all leading spaces. The result was: a b c It seems as if kate reevaluates the same line again and again till there is no match and this leads to the visible result. In my opinion the search for the next match should start after the last one in a global search and replace as this is done for all normal searches and this means that the beginning of the current line is no longer included in the search.
This sounds like a duplicate of another repeated-replacing bug. Also since searching was re-implemented in between I think this bug can be closed.
I don't know if this really has been fixed at some point, but it has the broken (or at least unexpected) behavior again. It also happens with other assertions: if e.g. you replace "(?<= )." with "", it removes everything after the first space, rather than only the first character after each space; likewise, if you replace "\b\w" with "", it removes every word character, rather than just the first character of each word. My guess as to why this happens is that in each replacement step, Kate first preforms a replacement, then moves the cursor to the end of the replacement text (which is empty in our examples), and then performs the next search beginning from there. Instead, when using Replace All, it should first find all instances to replace, and then perform all the replacements. This is what other regex replacement engines seem to do, such as those of sed and javascript (at least in effect; I don't know how they are implemented). When using the Replace button, it should probably take into account the result of previous replacement, but not the current replacement, when finding the next occurrence of the search string.
Not reproducible with latest master. For new bugs => new reports. Lets let the old ones rest.
(In reply to Waqar Ahmed from comment #3) > Not reproducible with latest master. For new bugs => new reports. Lets let > the old ones rest. Still reproducible with 22.04.2 as well as the latest master (da4b519d2). I opened a new bug report (Bug 455995).