I want to be able to run a search and replace where it ignores the case of the found items, but it doesn't change the case of any of the letters in them either. Basically, if I want to search and replace 'red' with 'blue', the following should happen;
red -> blue
Red -> Blue
RED -> BLUE
reD -> bluE
And so on.
-
It may be achieved by writing a small Java program. In Java regex you can catch the matched group. Thus we can identify the letters and the case's of these letters. BUT IMHO it is difficult to do this using Eclipse "Find and Replace" dialog. If you are expecting such program then update your post with exact need i.e if the matched group has all lower case letter then the replacement should be in lower case letters. If the matched group has ALL upper case letters then the replace group should be in upper case letters etc etc.Chandrayya G K– Chandrayya G K2014年02月07日 06:13:39 +00:00Commented Feb 7, 2014 at 6:13
2 Answers 2
You can do the first three cases using eclipse regex replace pattern \C.
Anything following the \C pattern will take on the casing of the replaced string (all lower case, capitalized, all upper case).
red -> \Cblue will give the following
red -> blue
rEd -> blue
reD -> blue
Red -> Blue
RED -> BLUE
Comments
Use emacs. It does that automatically (except for the last case, which is unusual).