Class RegexFunction

    • Constructor Detail

      • RegexFunction

        public RegexFunction()
    • Method Detail

      • copy

        public RegexFunction copy()
        Make a copy of this SystemFunction. This is required only for system functions such as regex functions that maintain state on behalf of a particular caller.
        Specified by:
        copy in interface StatefulSystemFunction
        Returns:
        a copy of the system function able to contain its own copy of the state on behalf of the caller.
      • allowRegexMatchingEmptyString

        protected abstract boolean allowRegexMatchingEmptyString()
      • makeFunctionCall

        public Expression makeFunctionCall​(Expression... arguments)
        Make an expression that either calls this function, or that is equivalent to a call on this function
        Overrides:
        makeFunctionCall in class SystemFunction
        Parameters:
        arguments - the supplied arguments to the function call
        Returns:
        either a function call on this function, or an expression that delivers the same result
      • makeOptimizedFunctionCall

        public Expression makeOptimizedFunctionCall​(ExpressionVisitor visitor,
                                                    ContextItemStaticInfo contextInfo,
                                                    Expression... arguments)
                                             throws XPathException
        Allow the function to create an optimized call based on the values of the actual arguments
        Overrides:
        makeOptimizedFunctionCall in class SystemFunction
        Parameters:
        visitor - the expression visitor
        contextInfo - information about the context item
        arguments - the supplied arguments to the function call. Note: modifying the contents of this array should not be attempted, it is likely to have no effect.
        Returns:
        either a function call on this function, or an expression that delivers the same result, or null indicating that no optimization has taken place
        Throws:
        XPathException - if an error is detected
      • getRegularExpression

        protected RegularExpression getRegularExpression​(Sequence[] args,
                                                         int regexPos,
                                                         int flagsPos)
                                                  throws XPathException
        Get the regular expression at evaluation time
        Parameters:
        args - the argument values in the function call
        Returns:
        the compiled regular expression; either the expression pre-compiled statically, or the result of compiling it dynamically. The XPath 4.0 tokenize() function allows the argument to be an empty sequence; in this case return null.
        Throws:
        XPathException - if the regular expression is invalid