java.util.regex · java.base · since Java 1.4
Pattern
public final class Pattern implements SerializableA compiled regular expression — compile once as a static final constant, then hand out Matchers. Flags, named groups, and stream-friendly splitting included.
Key methods
static Pattern compile(String regex, int flags) | CASE_INSENSITIVE, MULTILINE, DOTALL… |
Matcher matcher(CharSequence input) | The matching engine (not thread-safe; Pattern is). |
String[] split(CharSequence) / Stream<String> splitAsStream(…) | Regex splitting. |
static String quote(String s) | Escape a literal for embedding in a regex. |
Predicate<String> asMatchPredicate() | Whole-string predicate for filter chains. |