Class SimpleRegexMatcher


  • public class SimpleRegexMatcher
    extends RegexMatcher

    Simple regex pattern matching algorithm.

    This uses just two wildcards:

    • * matches any sequence of none, one or more characters
    • ? matches any one character
    Escaping these wildcards is not supported .

    Since:
    1.5
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static org.apache.commons.logging.Log baseLog
      Default log (class wide)
      private org.apache.commons.logging.Log log
      Custom log (can be set per object)
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.apache.commons.logging.Log getLog()
      Gets the Log implementation.
      boolean match​(java.lang.String basePattern, java.lang.String regexPattern)
      Matches using simple regex algorithm.
      private boolean match​(java.lang.String basePattern, java.lang.String regexPattern, int baseAt, int regexAt)
      Implementation of regex matching algorithm.
      void setLog​(org.apache.commons.logging.Log log)
      Sets the current Log implementation used by this class.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • baseLog

        private static final org.apache.commons.logging.Log baseLog
        Default log (class wide)
      • log

        private org.apache.commons.logging.Log log
        Custom log (can be set per object)
    • Constructor Detail

      • SimpleRegexMatcher

        public SimpleRegexMatcher()
    • Method Detail

      • getLog

        public org.apache.commons.logging.Log getLog()
        Gets the Log implementation.
      • setLog

        public void setLog​(org.apache.commons.logging.Log log)
        Sets the current Log implementation used by this class.
      • match

        public boolean match​(java.lang.String basePattern,
                             java.lang.String regexPattern)
        Matches using simple regex algorithm.
        Specified by:
        match in class RegexMatcher
        Parameters:
        basePattern - the standard digester path representing the element
        regexPattern - the regex pattern the path will be tested against
        Returns:
        true if the given pattern matches the given path
      • match

        private boolean match​(java.lang.String basePattern,
                              java.lang.String regexPattern,
                              int baseAt,
                              int regexAt)
        Implementation of regex matching algorithm. This calls itself recursively.