Atthapon Junpun-eak
Atthapon Junpun-eak

Reputation: 540

How to do bulk text replacement in Eclipse?

I'm trying to replace the line below (existing on more than 1000 java file) with my own line but I don't know how to do it on Eclipse.

Image.getInstance(pathConverter.getAbsolutePath("common/img/filename.jpg"));

"filename" is different on each java file.

I'm trying with this but it doesn't work (I'm not good at regular expression)

Image.getInstance(pathConverter.getAbsolutePath("common/img/(.*)"));

What is the correct regular expression for this?

Upvotes: 0

Views: 63

Answers (2)

Sajan Chandran
Sajan Chandran

Reputation: 11487

You can do

Search -> File Search -> Enter regex -> Click Replace ->

Regex is

Image\.getInstance\(pathConverter\.getAbsolutePath\("common/img/.*\.jpg"\)\);

You need to escape the ., (, ) in your path with \

Upvotes: 1

Soumyadip
Soumyadip

Reputation: 11

Simple, follow these steps :

  1. Go to Search and then File.
  2. Enter text, file pattern and projects.
  3. Replace
  4. Enter New text.

and you are done.

Upvotes: 1

Related Questions