GeezerVison is showing docs.oracle.com — Pattern (Java Platform SE 8 )
Java™ Platform Standard Ed. 8
compact1, compact2, compact3
java.util.regex
Class Pattern
-
-
Field Summary
Fields
| Modifier and Type |
Field |
Description |
static int |
CANON_EQ |
Enables canonical equivalence.
|
static int |
CASE_INSENSITIVE |
Enables case-insensitive matching.
|
static int |
COMMENTS |
Permits whitespace and comments in pattern.
|
static int |
DOTALL |
Enables dotall mode.
|
static int |
LITERAL |
Enables literal parsing of the pattern.
|
static int |
MULTILINE |
Enables multiline mode.
|
static int |
UNICODE_CASE |
Enables Unicode-aware case folding.
|
static int |
UNICODE_CHARACTER_CLASS |
Enables the Unicode version of Predefined character classes and
POSIX character classes.
|
static int |
UNIX_LINES |
Enables Unix lines mode.
|
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods
| Modifier and Type |
Method |
Description |
Predicate<String> |
asPredicate() |
Creates a predicate which can be used to match a string.
|
static Pattern |
compile(String regex) |
Compiles the given regular expression into a pattern.
|
static Pattern |
compile(String regex,
int flags) |
Compiles the given regular expression into a pattern with the given
flags.
|
int |
flags() |
Returns this pattern's match flags.
|
Matcher |
matcher(CharSequence input) |
Creates a matcher that will match the given input against this pattern.
|
static boolean |
matches(String regex,
CharSequence input) |
Compiles the given regular expression and attempts to match the given
input against it.
|
String |
pattern() |
Returns the regular expression from which this pattern was compiled.
|
static String |
quote(String s) |
Returns a literal pattern String for the specified
String.
|
String[] |
split(CharSequence input) |
Splits the given input sequence around matches of this pattern.
|
String[] |
split(CharSequence input,
int limit) |
Splits the given input sequence around matches of this pattern.
|
Stream<String> |
splitAsStream(CharSequence input) |
Creates a stream from the given input sequence around matches of this
pattern.
|
String |
toString() |
Returns the string representation of this pattern.
|
-
-
Method Detail
-
toString
public String toString()
Returns the string representation of this pattern. This
is the regular expression from which this pattern was
compiled.
- Overrides:
toString in class Object
- Returns:
- The string representation of this pattern
- Since:
- 1.5
Java™ Platform Standard Ed. 8
Submit a bug or feature For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. Copyright © 1993, 2026, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
|