Bug 315770

Summary: Kate search and replace plugin regular expressions are not greedy
Product: [Applications] kate Reporter: Todd <toddrme2178>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In: 4.11

Description Todd 2013-02-25 21:17:44 UTC
The kate search and replace plugin supports regular expressions.  However, unlike the regular expression system in the normal kate find/replace tool, and unlike most other regular expression implementations, the one in the search and replace tool is not "greedy", that is it finds the smallest possible match rather than the largest.

Reproducible: Always

Steps to Reproduce:
1. Open a new kate document
2. In the document, type this "111111" (no quotes)
3. Open the search and replace plugin.
4. In the plugin, type this "[1]+" (no quotes)
5. Check the "Regular Expressions" checkbox
6. Press "search"
Actual Results:  
You get 6 matches, each with one character

Expected Results:  
You get 1 match, "11111".  

The normal find/replace tool has 1 match, "11111".  In other words, the normal find/replace tool behavior is the same as the expected behavior for the search and replace plugin.
Comment 1 Kåre Särs 2013-02-26 17:08:03 UTC
Git commit 3923865136abf75ddfb1ca2e1170e33d32316383 by Kåre Särs.
Committed on 26/02/2013 at 16:41.
Pushed by sars into branch 'master'.

S&R: Start searching for the next match after the end of the previous match
FIXED-IN: 4.11

M  +1    -1    kate/plugins/search/search_folder.cpp
M  +1    -1    kate/plugins/search/search_open_files.cpp
M  +1    -1    kate/plugins/search/search_project.cpp
M  +1    -1    kate/plugins/search/search_while_typing.cpp

http://commits.kde.org/kate/3923865136abf75ddfb1ca2e1170e33d32316383