Eclipse, regular expression search and replace

前端 未结 5 1705
清酒与你
清酒与你 2020-11-30 17:39

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

5条回答
  •  半阙折子戏
    2020-11-30 17:45

    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)

    Hint: CTRL + Space in the textboxes gives you all kinds of suggestions for regular expression writing.

提交回复
热议问题