Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse : search for only a particular word under Eclipse IDE

Tags:

eclipse

Is it possible to search for only a particular word under Eclipse IDE . For example i need to search for a word "sub" .

But the problem is that , when i did ctr l + H and typed the word "sub" , it producing all matching results such as submit ----etc , but i want the exact word "sub" in my Search .

Please let me know if its possible ??

Thanks in advance .

like image 831
Pawan Avatar asked Aug 06 '12 10:08

Pawan


People also ask

How do I find a specific word in Eclipse?

The Eclipse search dialog box allows you to search for files that contain a literal or a character pattern in the entire workspace, a set of projects, a specific project or folders selects in the package explorer view. Clicking on the Search menu and selecting Search or File or Java. Clicking Ctrl + H.

How do I search for a text in a class File in Eclipse?

You can also use the Ctrl + H shortcut to search files in Eclipse project.

How do I search for a function in Eclipse?

Use Ctrl + G to find all uses of a function in the project. Its Ctrl+Shift+G to search the function call in the entire workspace ctrl+G is only for the project. In general Ctrl+Shift+L gives all the commands.


1 Answers

Try using regular expressions in the File Search Dialogue (Ctrl + H). You can use the word boundaries modifier \b like so :

Eclipse Regular Expression Search

\bsub\b asks eclipse to search for all matches in which sub is both followed and preceded by a word boundary. Read more about word boundaries here.

Here is a sample snapshot of the Search Results using the above:

Word Boundaries Search

If you want to restrict the search to the current project then try selecting 'Enclosing Projects' radio option. This option will be disabled if you don't already have a file from the Project opened. To get past this annoyance, I would recommend creating a Working Set with just the project(s) of interest and then restricting the search on that Working Set.

like image 140
Ashutosh Jindal Avatar answered Oct 14 '22 05:10

Ashutosh Jindal