Reputation: 769
Can someone help me with the regular expression to find and replace a particular code inside a large project in eclipse I am working on:
Eg: I want to select all code that contains following "new ArrayList<some value..>();
"
Like:
new ArrayList<Content>();
new ArrayList<User>();
new ArrayList<Content_User_Mapping>();
and replace with:
new ArrayList<Content>(0);
new ArrayList<User>(0);
new ArrayList<Content_User_Mapping>(0);
Any help would be much appreciated, thanks.
Upvotes: 1
Views: 35
Reputation: 421030
Try replacing ArrayList<(.*)>\(\)
with ArrayList<$1>(0)
.
What to keep in mind when dealing with the search and replace dialog:
(
and )
are special and needs to be escaped(...)
represents a group(
and )
, but allows you to refer to the captured groups by $n
.Upvotes: 1