Java Reference
In-Depth Information
Symbol Meaning in Regular Expres-
sions
Meaning in Character Classes
(
matches with)to group subex-
pressions.
Represents itself.
)
matches with(to group subex-
pressions.
Represents itself.
[
Begins a character class.
Represents itself.
]
Represents itself.
Ends a character class.
{
Matches with
}
to signal macro-
Represents itself.
expansion.
}
Matches with
{
to signal macro-
Represents itself.
expansion.
"
Matches with " to delimit
strings.
Represents itself.
\
Escapes individual characters.
Also used to specify a character
by its octal code.
Escapes individual characters.
Also used to specify a character
by its octal code.
.
Matches any one character ex-
cept
Represents itself.
\
n.
|
Alternation (or) operator.
Represents itself.
*
Kleene closure operator (zero
or more matches).
Represents itself.
+
Positive closure operator (one
or more matches).
Represents itself.
?
Optional choice operator (one
or more matches)
Represents itself.
/
Context-sensitivematching op-
erator.
Represents itself.
ˆ
Matches only at the beginning
of a line.
Complements the remaining
characters in the class.
$
Matches only at the end of a
line.
Represents itself.
-
Represents itself.
The range of characters opera-
tor.
Figure 3.13: Meaning of operators and special symbols in Lex.
Search WWH ::




Custom Search