public final class Pattern extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
static int |
CANON_EQ |
static int |
CASE_INSENSITIVE |
static int |
COMMENTS |
static int |
DOTALL |
static int |
MULTILINE |
static int |
UNICODE_CASE |
static int |
UNIX_LINES |
Modifier and Type | Method and Description |
---|---|
static Pattern |
compile(String regex) |
static Pattern |
compile(String regex,
int flags) |
int |
flags() |
Matcher |
matcher(CharSequence input) |
static boolean |
matches(String regex,
CharSequence input) |
String |
pattern() |
String[] |
split(CharSequence input) |
String[] |
split(CharSequence input,
int limit) |
String |
toString()
Return the regular expression used to construct this object.
|
public static final int CANON_EQ
public static final int CASE_INSENSITIVE
public static final int COMMENTS
public static final int DOTALL
public static final int MULTILINE
public static final int UNICODE_CASE
public static final int UNIX_LINES
public static Pattern compile(String regex) throws PatternSyntaxException
regex
- The regular expressionPatternSyntaxException
- If the expression's syntax is invalidpublic static Pattern compile(String regex, int flags) throws PatternSyntaxException
regex
- The regular expressionflags
- The match flags, a bit maskPatternSyntaxException
- If the expression's syntax is invalidIllegalArgumentException
- If bit values other than those
corresponding to the defined match flags are set in flagspublic int flags()
public static boolean matches(String regex, CharSequence input)
regex
- The regular expressioninput
- The character sequence to be matchedPatternSyntaxException
- If the expression's syntax is invalidpublic Matcher matcher(CharSequence input)
input
- The character sequence to be matchedpublic String[] split(CharSequence input)
input
- The character sequence to be matchedpublic String[] split(CharSequence input, int limit)
input
- The character sequence to be matchedlimit
- The result thresholdpublic String toString()
toString
in class Object
Object.getClass()
,
Object.hashCode()
,
Class.getName()
,
Integer.toHexString(int)