2

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.

asked Feb 7, 2014 at 4:46
1
  • 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. Commented Feb 7, 2014 at 6:13

2 Answers 2

4

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
answered Apr 9, 2020 at 11:24
Sign up to request clarification or add additional context in comments.

Comments

-1

Use emacs. It does that automatically (except for the last case, which is unusual).

answered Feb 7, 2014 at 4:53

1 Comment

Just installed it, how would I accomplish this specific functionality?

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.