The standard replace dialog supports on-the-fly case conversion using \U and \L in the replace expression. For example. find: (a), replace: \U\1 will replace lowercase 'a' with uppercase 'A'. The Search & Replace plugin does not currently support this feature. Reproducible: Always Steps to Reproduce: 1. Open a file that contains lower-case text 2. Open the Search & Replace plugin 3. Search in: Current File 4. Enable Regular Expressions 5. Find: (.*) 6: Replace: \U\1 7: Press Search 8: Press Replace checked Actual Results: \U is placed at the beginning of every line Expected Results: Lowercase letters are replaced by uppercase letters. This can be tested using the same settings with the standard replace dialog. Kate version 16.07.70 built from source on Windows using Visual Studio 2015.
good idea!
A related request, possibly different enough to make a entry, but let's start by putting it here. I'd like to propose a 'smart case match' option for search-and-replace that would make the case in the replaced text match the case in the search text. The reason is that I often find myself having to repeat search-and-replace functions to cover the same word written in different case styles. For instance if I want to rename an object 'foo' to the name 'bar', I typically need to do some or all of the following: 'foo' -> 'bar' 'Foo' -> 'Bar' 'FOO' -> 'BAR" and it seems that a single smart search-and-replace could do all three at once by taking note of the case specified in the search and replace boxes.
Jonathan: The idea is not bad, but it would probably complicate the code quite much. How would you capitalize the following: foo -> baar but how about: FOO -> BAAr or FOO -> BAAR And how do you convert all instances of Foo, foo, FOO and fOO to Foo? I think the replace needs to be case sensitive except if you have explicit \U, \L or \I. Unfortunately I don't think this reaches very high on my priority list. Sorry :( ('\U\1' and friends is on my TODO)
All it would have to do is three case-sensitive search-and-replace operations: 1. Exactly as the user entered; 2. Substituting both fields with lower case; 3. Substituting both fields with upper case. I can't see much sense in trying to be smarter than that. Anyway I see that it is quite a different problem from the one you are setting out to solve, but I'm happy to write it myself and propose it as a patch. If no-one but me likes it I'll keep it as a personal fork, wouldn't be the first time. :)
Can this be closed? Now is the mentioned \U available
The feature does appear to be implemented now. I didn't do much testing, but I did get the expected behavior using the steps I submitted in the original request. I'm good with closing this issue. Thanks!