Java Reference
In-Depth Information
A convenience method that splits the given input sequence
around matches of this pattern. Equivalent to
split(input,0)
.
public static boolean
matches(String regex, CharSequence input)
A convenience method that compiles the given regular ex-
pression and attempts to match the given input against it.
Useful when you do not need to reuse either parser or match-
er. Returns
true
if a match is found.
public static String
quote(String str)
Returns a string that can be used to create a pattern that
would match with
str
.
The
toString
method of a
Pattern
also returns the regular expression
from which the pattern was compiled.
The flags you can specify when creating the pattern object affect how
the matching will be done. Some of these affect the performance of
the matching, occasionally severely, but they may be functionality you
need.
Flag
Meaning
Case-insensitive matching. By default, only
handle case for the ASCII characters.
CASE_INSENSITIVE
Unicode-aware case folding when combined
with
CASE_INSENSITIVE
UNICODE_CASE
Canonical equivalence. If a character has
multiple expressions, treat them as equival-
CANON_EQ