Class RegexEngine

java.lang.Object
org.apache.jena.sparql.expr.RegexEngine
Direct Known Subclasses:
RegexEngine.RegexJava, RegexEngine.RegexXerces

public abstract class RegexEngine extends Object
Encapsulate a specific regular expression systems.

The two provided are the regular expression implement in Apache Xerces (2.11.0) and the JDK java.util.regex.

By default java.util.regex is used. It does not support the "x" flag.

The default is set by symbol ARQ.regexImpl (comand line arq:regexImpl) to either "javaRegex" or "xercesRegex".

  • Constructor Details

    • RegexEngine

      public RegexEngine()
  • Method Details

    • match

      public abstract boolean match(String string)
    • setRegexImpl

      public static void setRegexImpl(RegexEngine.RegexImpl valRegexImpl)
      For testing
    • makePattern

      public static Pattern makePattern(String label, String patternStr, String flags)
    • makeMask

      public static int makeMask(String modifiers)
    • create

      public static RegexEngine create(String pattern, String flags)
    • timeBounded

      public static CharSequence timeBounded(CharSequence charSequence)
      Returns a potentially time-bounded character sequence

      If SparqlLimits.MAX_REGEX_EVALUATION_TIME is set to a positive non-zero value then a time-bounded CharSequence is returned to prevent regular expression evaluation taking too long. If it's set to anything else then the original character sequence is returned.

      Parameters:
      charSequence - Original character sequence to time bound
      Returns:
      Possible time-bounded Character Sequence, or null if the input was null