java.util.regex compiles patterns into an internal matching engine (`Pattern`) and creates per-input cursors (`Matcher`). Understanding matches() vs find(), greedy vs reluctant quantifiers, and catastrophic backtracking keeps regex parsers fast and safe.
More lessons in Complete Core Java