Java Reference
In-Depth Information
PATTERN.COMPILE() FLAGS
Half a dozen flags can be passed as the second argument to
Pattern.compile()
. If more than
one value is needed, they can be or'd together using the bitwise or operator
|
. In alphabetical or-
der, the flags are:
CANON_EQ
Enables so-called “canonical equivalence.” In other words, characters are matched by their
base character, so that the character
e
followed by the “combining character mark” for the
acute accent (
´
) can be matched either by the composite character
é
or the letter
e
followed by
the character mark for the accent (see
Matching “Accented” or Composite Characters
)
.
CASE_INSENSITIVE
Turns on case-insensitive matching (see
Controlling Case in Regular Expressions
).
COMMENTS
Causes whitespace and comments (from
#
to end-of-line) to be ignored in the pattern.
DOTALL
Allows dot (.) to match any regular character or the newline, not just any regular character
other than newline (see
Matching Newlines in Text
)
.
MULTILINE
Specifies multiline mode (see
Matching Newlines in Text
)
.
UNICODE_CASE
Enables Unicode-aware case folding (see
Controlling Case in Regular Expressions
).
UNIX_LINES