# Bug 324924

Summary: Product: kate search & replace plugin: replace field should accept regular expressions in regular expression mode kate Erik Quaeghebeur general KWrite Developers RESOLVED FIXED normal kare.sars NOR 3.10.5 --- Gentoo Packages Linux http://commits.kde.org/kate/b7fbc9452bde1bb9b458c821a93385b2c42bcd5f 4.12

 Erik Quaeghebeur 2013-09-15 10:01:26 UTC In Kate (and the programs that make use of katepart, such as Kile), the search dialog (Ctrl-R) allows one to go into regular expression mode and use subsexpressions in the replacement field, i.e., the replacement field is then also interpreted as a regular expression. In the Kate search & replace plugin, however, the replacement field stays a literal field, so a big part of the power of using regular expressions is lost. An example: replace \{\\em ([^\}]*)\} by \\emph\{\1\}. So my request: make the plugin replacement field behave as the dialog replacement field. I chose as severity 'normal bug' and not 'feature request' , because the current plugin behavior breaks consistency with the existing dialog behavior. Of course having subexpression reuse capabilities with the search & replace plugin would be great, because the dialog only allows replacing in the current file. (Side question: will the plugin replace or be merged with the dialog in the future? Once this bug's issue is resolved and the ability to restrict to 'selection' and 'current file' is added next to 'all open files' and 'files in folder' is added, it would be a great improvement, as the plugin seems not be be available in katepart users such as Kile, making me switch applications just for search and replace.) Reproducible: Always Kåre Särs 2013-09-15 18:04:43 UTC Thanks for the report. Could you add a wish for the "selection and current file" option? (one wish per issue ;) The built-in is the defacto standard, but I wonder why we need to escape anything else than the capture... With the plugin it should be possible to do: replace \{\\em ([^\}]*)\} by \emph{\1} and "{\em 1234}" becomes "\emph{1234}" For some reason "Replace checked" works, but not "Replace" (in kde 4.11.1) That I have to investigate further... Kåre Särs 2013-09-19 19:43:01 UTC After a bit of investigating I notice that the feature was added after 4.10, so it only exists in > 4.11 ;) Tuns out that the "replace not working" bug is in Untitled and never saved documentts. That needs to be fixed! So this is basically fixed but I'll keep it open until I have fixed the replacing in the untitled files. Erik Quaeghebeur 2013-09-20 08:40:35 UTC (In reply to comment #2) > So this is basically fixed but I'll keep it open until I have fixed the > replacing in the untitled files. Ok, I'll see it appear when my distro moves to 4.11. Thanks for your efforts! Kåre Särs 2013-10-16 18:00:02 UTC Git commit b7fbc9452bde1bb9b458c821a93385b2c42bcd5f by Kåre Särs. Committed on 16/10/2013 at 17:54. Pushed by sars into branch 'master'. S&R: Fix searching in never saved files + multiplex using roles The match data is now saved in column 0 with custom roles in stead of using UserRole in many columns. The custom roles also have enums for better readability. M +2 -2 addons/kate/search/SearchDiskFiles.cpp M +1 -1 addons/kate/search/SearchDiskFiles.h M +85 -59 addons/kate/search/plugin_search.cpp M +2 -2 addons/kate/search/plugin_search.h M +31 -10 addons/kate/search/replace_matches.cpp M +13 -0 addons/kate/search/replace_matches.h M +2 -2 addons/kate/search/search_open_files.cpp M +1 -1 addons/kate/search/search_open_files.h http://commits.kde.org/kate/b7fbc9452bde1bb9b458c821a93385b2c42bcd5f