How to replace uppercase letters to lowercase letters using regex in Eclipse?

Viewed 26508

I'd like to go through all of my source code files and replace every occurence of k_Xyyy with k_xyyy (switch the first letter after k_ from uppercase to lowercase).

I'm using the eclipse dialog to search and replace multiple files. Right now I have the regex \bk_([A-Z]).

How do I specify the replacement string of the regex?

4 Answers

That is not possible. Either use Eclipse's re-factoring functionality, or replace them one at a time:

regex       : \bk_A
replacement : k_a 

regex       : \bk_B
replacement : k_b 

...

regex       : \bk_Z
replacement : k_z 

(for me, since I just started programming, this was more fun to think about) Take $pattern_to_change and convert it from ascii to decimal using ord().Take the resulting dec number and add 32. Then convert $desired_pattern back to ascii using chr().

Or just download SublimeText and use its Find and Replace feature to Find All occurrences and replace them with difference text (Sublime has regex as well).

I'm sure you could have converted one billion by hand since this post is like 5 years old, but you could have complete this in 5 minutes with Sublime.

Really useful text editor.

Related