Java Reference
In-Depth Information
Searching within the active editor
If you need a search with a little more con-
trol than is offered by the incremental
search, you can use the standard search tool,
accessed through the
Search | Find
option,
the
Find
toolbar icon, or the shortcut
Ctrl+
F
. This action displays a
Find Text
window,
as shown in figure 2.16.
If you have a current selection
when you bring up the search
window, it will be prepopulated
as the text to find.
TIP
Figure 2.16 The Find operation searches
only the currently opened file in the editor,
using the options and scope you specify in
this window.
Enter the text you want to search for in the
Tex t t o f i n d
field. This field accepts
text directly, but it also has a history drop-down that remembers your recent
search terms. The dialog's options let you control the various search options:
Case sensitive
, if selected, finds only results matching your search text
exactly, in terms of upper- and lowercase letters. Otherwise, case isn't con-
sidered when searching for matching text.
■
Whole words only
, if enabled, requires the entire search term to appear
alone, surrounded by the start of a line, a space, a tab, or some other
punctuation (for example, if you type
fox
and enable this option, then
foxtrot
won't be found as a match). This option is disabled when using
regular expressions.
■
Regular expressions
interprets the search text as a regular expression
rather than a simple text match.
IDEA
uses the
JDK
1.4 regular expression
library for parsing the regular expression, which is very similar to Perl 5
regular expression syntax; refer to the Java
SDK
documentation (specifi-
cally, the
java.util.regexp.Pattern
class) for information on writing regu-
lar expressions.
■
Scope
specifies the search's scope. If you select the
Selected text
option,
the search only occurs within the current selection (if any) rather than the
entire document (as specified by the
Global
option).
■
Direction
specifies the search direction for finding successive matches (for-
ward or backward).
■