Bug 429876

Summary: Inconsistency with regexp matching whole line in search and replace
Product: [Applications] kate Reporter: Alexander Trufanov <trufanovan>
Component: searchAssignee: KWrite Developers <kwrite-bugs-null>
Status: CONFIRMED ---    
Severity: normal CC: christoph
Priority: NOR    
Version First Reported In: 20.08.2   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Alexander Trufanov 2020-12-01 04:49:02 UTC
SUMMARY

It seems the "(.*)" regexp matches each line two times (whole line and \n) if it's searched with Ctrl+R and only ones (whole line with \n) if it's searched via Ctrl+Alt+F. Which is inconsistent.

STEPS TO REPRODUCE
1. Create a new file
2. Type in 2 lines:
"
file1
file2
"
3. Press Ctrl+R
4. Set Find field to "(.*)" to match whole string
5. Set Replace field to "mv \1 ./folder/" to move both file1 and file2 to subfolder.
6. Set Mode: to Regular expression.
7. Press "Find All" then "Replace All".

OBSERVED RESULT

Text after replacement:
"
mv file1 ./folder/mv  ./folder/
mv file2 ./folder/mv  ./folder/
"

EXPECTED RESULT

Text after replacement:
"
mv file1 ./folder/
mv file2 ./folder/
"

SOFTWARE/OS VERSIONS
Operating System: Kubuntu 20.10
KDE Plasma Version: 5.19.5
KDE Frameworks Version: 5.74.0
Qt Version: 5.14.2
Kernel Version: 5.8.0-29-generic
OS Type: 64-bit
Processors: 4 × Intel® Core™ i7-3520M CPU @ 2.90GHz
Memory: 7,6 GiB of RAM
Graphics Processor: Mesa DRI Intel® HD Graphics 4000

ADDITIONAL INFORMATION

If you do the same not after pressing Ctrl+R , but with "Search and Replace" TAB ( Ctrl+Alt+F) the result will be as expected. Which is misleading.