public final class Pattern extends java.lang.Object implements java.io.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(java.lang.String regex) |
static Pattern |
compile(java.lang.String regex,
int flags) |
int |
flags() |
Matcher |
matcher(java.lang.CharSequence input) |
static boolean |
matches(java.lang.String regex,
java.lang.CharSequence input) |
java.lang.String |
pattern() |
static java.lang.String |
quote(java.lang.String str)
Returns a literal pattern for the specified String.
|
java.lang.String[] |
split(java.lang.CharSequence input) |
java.lang.String[] |
split(java.lang.CharSequence input,
int limit) |
java.lang.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(java.lang.String regex) throws PatternSyntaxException
regex - The regular expressionPatternSyntaxException - If the expression's syntax is invalidpublic static Pattern compile(java.lang.String regex, int flags) throws PatternSyntaxException
regex - The regular expressionflags - The match flags, a bit maskPatternSyntaxException - If the expression's syntax is invalidjava.lang.IllegalArgumentException - If bit values other than those
corresponding to the defined match flags are set in flagspublic int flags()
public static boolean matches(java.lang.String regex, java.lang.CharSequence input)
regex - The regular expressioninput - The character sequence to be matchedPatternSyntaxException - If the expression's syntax is invalidpublic Matcher matcher(java.lang.CharSequence input)
input - The character sequence to be matchedpublic java.lang.String[] split(java.lang.CharSequence input)
input - The character sequence to be matchedpublic java.lang.String[] split(java.lang.CharSequence input, int limit)
input - The character sequence to be matchedlimit - The result thresholdpublic java.lang.String pattern()
public static java.lang.String quote(java.lang.String str)
String - to return a literal pattern for.java.lang.NullPointerException - if str is null.public java.lang.String toString()
toString in class java.lang.ObjectObject.getClass(),
Object.hashCode(),
Class.getName(),
Integer.toHexString(int)