In eclipse, is it possible to use the matched search string as part of the replace string when performing a regular expression search and replace?
Basically, I want
Yes, "( )" captures a group. you can use it again with $i where i is the i'th capture group.
So:
search: (\w+\.someMethod\(\)) replace: ((TypeName)$1)
search: (\w+\.someMethod\(\))
(\w+\.someMethod\(\))
replace: ((TypeName)$1)
((TypeName)$1)
Hint: CTRL + Space in the textboxes gives you all kinds of suggestions for regular expression writing.