Class SimplePatternSearcher

  • All Implemented Interfaces:
    PatternSearcher

    public class SimplePatternSearcher
    extends java.lang.Object
    implements PatternSearcher
    This class helps with "simple" pattern matching. That is, it will take a pattern and apply stars (*) and question marks (?) to mean match any, and match one respectively.
    • Constructor Detail

      • SimplePatternSearcher

        public SimplePatternSearcher​(java.lang.String pattern)
      • SimplePatternSearcher

        public SimplePatternSearcher​(java.lang.String pattern,
                                     boolean matchLine)
    • Method Detail

      • setPattern

        public void setPattern​(java.lang.String pattern)
      • setPattern

        public void setPattern​(java.lang.String pattern,
                               boolean matchLine)
        Parameters:
        pattern - The pattern string to use. If null or blank, any string will match successfully.
        matchLine - If true, the pattern will be applied to the whole string. If false, the pattern will get "*" appended to the front and back so that it matches mid-line.
      • getPattern

        public java.util.regex.Pattern getPattern()
      • matches

        public boolean matches​(java.lang.CharSequence input)
        Specified by:
        matches in interface PatternSearcher
      • matches

        public static boolean matches​(java.lang.String pattern,
                                      java.lang.CharSequence input)