Reputation: 32331
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 .
Upvotes: 5
Views: 15673
Reputation: 65
Select the word and then press Ctrl+Alt+letter(G) it will search the word where it is used.
Upvotes: 1
Reputation: 18867
Try using regular expressions in the File Search Dialogue (Ctrl + H). You can use the word boundaries
modifier \b
like so :
\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:
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.
Upvotes: 15
Reputation: 72676
You can do it from Find/Replace menu (CTRL+F) and flagging the Whole word option :
Otherwise from the standard Search menu(CTRL+H) you can achieve the same result using an appropriate regular expression, in your case you just need to append a space after(or/and before) the sub text and you will get only the whole word.
Upvotes: 1