java.util.regex consists of three classes − Pattern class, Matcher class and PatternSyntaxException class.