As you may know, in Eclipse, we could search a text, which could be a field name or a method name, within a project or work-space, by using File Search. The results would be all the places that the text in question appears. Now, the issue is, I need to search for a number, i.e., 12. For example, number 12 has been used as a flag indicator in many places (in different java files) in a project, and I would like to find out all the places that this number is used. Is there a way to do this? I have tried to do the search in the same way as searching key word (File Search), but it did not work. Thank you very much.
Asked
Active
Viewed 389 times
0
-
Define *did not work*. – Aleksandr M Jul 14 '14 at 11:07
-
select your search string\number and then press `ctrl+alt+g` – Shailesh Aswal Jul 14 '14 at 11:07
-
1What you described *should* work. The *File search* tab in the *Search* dialog is a pure textual search, equivalent to a `grep`. On a side note, you [**shouldn't be using magic numbers**](http://stackoverflow.com/q/47882/2685386) – blgt Jul 14 '14 at 12:35
-
If you liked any post, feel free to accept it as correct answer. :-) – LastFreeNickname Aug 06 '14 at 08:24
3 Answers
1
It is perfectly possible to use the text search for numbers.
Search => File
Containing text: 12
File name patterns: Adjust to *.java
Scope: Workspace - for full search
Should work like a charm! :-)

LastFreeNickname
- 1,445
- 10
- 17
0
Ok..
- Type
12
in any file. - select the text (12)
- goto Search --> Text --> Project

demongolem
- 9,474
- 36
- 90
- 105

TheLostMind
- 35,966
- 12
- 68
- 104
0
Press CTRL+H
- A menu pops up.
Select the customize
button and in that check File Search field
Then in the File Search
tab define as follow -
In Containing Text Field
- type whatever you want to search.
In File name patterns field
- provide the files you want to search e.g- *.java
will search for all java
files.
Finally Hit search
. Shall give you the files containing the search number

SparkOn
- 8,806
- 4
- 29
- 34