Class SimplePatternSearcher

java.lang.Object
com.inductiveautomation.ignition.common.util.SimplePatternSearcher
All Implemented Interfaces:
PatternSearcher

public class SimplePatternSearcher extends 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 Details

    • SimplePatternSearcher

      public SimplePatternSearcher(String pattern)
    • SimplePatternSearcher

      public SimplePatternSearcher(String pattern, boolean matchLine)
  • Method Details

    • setPattern

      public void setPattern(String pattern)
    • setPattern

      public void setPattern(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 Pattern getPattern()
    • matches

      public boolean matches(CharSequence input)
      Specified by:
      matches in interface PatternSearcher
    • find

      @Nullable public PatternSearcher.SubstringLocation[] find(CharSequence input)
      Specified by:
      find in interface PatternSearcher
    • matches

      public static boolean matches(String pattern, CharSequence input)