java.util.regex · java.base · since Java 1.4
Matcher
public final class Matcher implements MatchResultThe stateful matching engine: matches() (whole input) vs find() (next occurrence), group access by index or name, and replace operations.
Key methods
boolean matches() | Entire input must match. |
boolean find() | Advance to the next match — loop it. |
String group(int n) / group(String name) | Captured text (group 0 = whole match). |
String replaceAll(String replacement) | $1 references groups; Matcher.quoteReplacement for literals. |