Class RegexpMatchFunctionHelper


  • public final class RegexpMatchFunctionHelper
    extends Object
    *-regexp-match function helper

    WARNING: the regular expression syntax required by XACML refers to the xf:matches function from [XF] (see the XACML core spec for this reference). This function and associated syntax differ from Pattern (Java 7) in several ways. Therefore, we cannot use Pattern directly. Find examples of differences below:

    • Pattern matches the entire string against the pattern always, whereas xf:matches considers the string to match the pattern if any substring matches the pattern.
    • xf:matches regular expression syntax is based on XML schema which defines character class substraction using '-' character, whereas Pattern does not support this syntax but &&[^ instead.
    • Category escape: can be done in XML SCHEMA with: [\P{X}]. Pattern only supports this form: [^\p{X}].
    • Character classes: XML schema define categories \c and \C. Pattern does not support them.
    EXAMPLE: this regex from XML schema spec uses character class substraction. It is valid for xf:matches but does not compile with Pattern:
     [\i-[:]][\c-[:]]*
     
    • Method Detail

      • getCompiledRegexMatchCall

        public FirstOrderFunctionCall<BooleanValue> getCompiledRegexMatchCall​(List<Expression<?>> argExpressions,
                                                                              Datatype<?>... remainingArgTypes)
        Creates regex-match function call using pre-compiled regex
        Parameters:
        argExpressions - input expressions
        remainingArgTypes - types of remaining arguments (after input expressions)
        Returns:
        function call using compiled regex from first argument if constant value; or null if first argument is not constant