Class regexMatchFunction

  • All Implemented Interfaces:
    FilterFunction

    public class regexMatchFunction
    extends Object
    implements FilterFunction
    Filter function that matches a value against a regular expression.

    REGEX( 'A.B', 'A-B' )

    Note that the regular expression is not anchored; use the anchor characters, ^ and $, as-needed. For example, REGEX( 'AA', 'XAAX' ) evaluates to true while REGEX( '^AA$' , 'XAAX' ) evaluates to false.

    • Constructor Detail

      • regexMatchFunction

        public regexMatchFunction()
    • Method Detail

      • isValid

        public boolean isValid​(FunctionCallExpression expr)
        Check whether the given expression is a valid call of this function. Two arguments are required. When evaluated, the arguments are converted to strings if they are not already strings.
        Specified by:
        isValid in interface FilterFunction
        Parameters:
        expr - - the expression consisting of a call to this function.
        Returns:
        true - if the expression is valid; false - otherwise.
      • returnsBoolean

        public boolean returnsBoolean​(FunctionCallExpression expr)
        Indicate that this Filter Function evaluates to a Boolean result.
        Specified by:
        returnsBoolean in interface FilterFunction
        Parameters:
        expr - - the expression consisting of a call to this function.
        Returns:
        true - this function always evaluates to a Boolean result.
      • evaluate

        public Object evaluate​(FunctionCallExpression expr,
                               MessageEvaluationContext message)
                        throws JMSException
        Evalutate the given expression, which consists of a call to this function, in the context given. Returns an indication of whether the second argument matches the regular expression in the first argument.
        Specified by:
        evaluate in interface FilterFunction
        Parameters:
        expr - - the expression consisting of a call to this function.
        message - - the context in which the call is being evaluated.
        Returns:
        true - if the value matches the regular expression; false - otherwise.
        Throws:
        JMSException
      • getCompiledPattern

        protected Pattern getCompiledPattern​(String reg_ex_str)
        Retrieve a compiled pattern for the given pattern string. A cache of recently used strings is maintained to improve performance.
        Parameters:
        reg_ex_str - - the string specifying the regular expression.
        Returns:
        Pattern - compiled form of the regular expression.