Class Matcher

  • Direct Known Subclasses:
    JdkMatcher

    public abstract class Matcher
    extends Object
    • Constructor Detail

      • Matcher

        public Matcher()
    • Method Detail

      • create

        public static Matcher create​(String input,
                                     Pattern pattern)
        Create a new matcher object, depending on the implementation
        Parameters:
        input - Input to match regular expressions agains
        pattern - Regular expression pattern
        Returns:
        A Matcher implementation
      • substitute

        public abstract String substitute​(Substitution substitution)
        Replace all matches in the input with a substitution. For every match substition.handleMatch is called.
        Parameters:
        substitution - Code which handles every substitution
        Returns:
        String with all matches substituted
      • substitute

        public abstract String substitute​(String substitution)
        Replace all matches in the input with a string substitution.
        Parameters:
        substitution - String to replace all matches
        Returns:
        String with all matches substituted
      • matches

        public abstract boolean matches()
        Test if a regular expression matches the complete input
        Returns:
        True if the regex matches the complete input
      • contains

        public abstract boolean contains()
        Test if a regular expression matches parts of the input
        Returns:
        True if the regex matches a part of the input