Class LookBehindRegexHolder


  • public class LookBehindRegexHolder
    extends Object
    Utility class to manage regular expressions that require simulated infinite lookbehind, e.g. to determine whether a sequence of escape characters is complete unto itself.
    • Field Detail

      • DEFAULT_INITIAL_MAXIMUM_LENGTH

        public static final int DEFAULT_INITIAL_MAXIMUM_LENGTH
        See Also:
        Constant Field Values
      • DEFAULT_EXPANSION_BLOCK_SIZE

        public static final int DEFAULT_EXPANSION_BLOCK_SIZE
        See Also:
        Constant Field Values
    • Constructor Detail

      • LookBehindRegexHolder

        public LookBehindRegexHolder​(String regex,
                                     IntUnaryOperator computeInjectedRepetition)
        Create a new LookBehindRegexHolder instance with the default initial maximum length and expansion block size.
        Parameters:
        regex - assumed to contain a %d Java format sequence
        computeInjectedRepetition - function to compute the injected number of repetitions to inject at %d in regex
      • LookBehindRegexHolder

        public LookBehindRegexHolder​(String regex,
                                     int initialMaximumLength,
                                     int expansionBlockSize,
                                     IntUnaryOperator computeInjectedRepetition)
        Create a new LookBehindRegexHolder instance.
        Parameters:
        regex - assumed to contain a %d Java format sequence
        initialMaximumLength - initial guess
        expansionBlockSize - number of bytes by which to increase the maximum length when a Matcher is requested for a larger message size
        computeInjectedRepetition - function to compute the injected number of repetitions to inject at %d in regex