The PatternMatcher interface defines the operations a regular
expression matcher must implement. However, the types of the Pattern
implementations recognized by a matcher are not restricted. Typically
PatternMatcher instances will only recognize a specific type of Pattern.
For example, the Perl5Matcher only recognizes Perl5Pattern instances.
However, none of the PatternMatcher methods are required to throw an
exception in case of the use of an invalid pattern. This is done for
efficiency reasons, although usually a CastClassException will be
thrown by the Java runtime system if you use the wrong Pattern
implementation. It is the responsibility of the programmer to make
sure he uses the correct Pattern instance with a given PatternMatcher
instance. The current version of this package only contains the Perl5
suite of pattern matching classes, but future ones for other regular
expression grammars may be added and users may also create their own
implementations of the provided interfaces. Therefore the programmer
should be careful not to mismatch classes.