Tag: Class needs to represent an input exception regex has no syntax object
I. Basic USE
The 1.java.util.regex package mainly consists of the following three classes:
- Pattern class:
The pattern object is a compiled representation of a regular expression. The pattern class has no public constructor method. To create a pattern object, you must first call its public static compilation method, which returns a Pattern object. The method takes a regular expression as its first argument.
- Matcher class:
The Matcher object is the engine that interprets and matches the input string. Like the pattern class, Matcher does not have a public construction method. You need to invoke the Matcher method of the Pattern object to get a Matcher object.
- Patternsyntaxexception:
Patternsyntaxexception is a non-mandatory exception class that represents a syntax error in a regular expression pattern.
Java Regular Expressions