setTimeoutValue

setTimeoutValue(timeoutInMilliseconds: Integer): JadeRegexPattern;

This method returns its own modified receiver, to allow call chaining. (By default, a Regex call does not time out; that is, the default value is zero (0).)

Call the setTimeoutValue method of the JadeRegexPattern class with the timeoutInMilliseconds parameter set to required number of milliseconds after which a single Regex call times out.

The following is an example of the setTimeoutValue method.

setTimeoutValueExample(possiblyDangerousRegex : String; text : String): String;
vars
    pattern : JadeRegexPattern;
    match : JadeRegexMatch;
    timedout : Boolean;
begin
    on JadeRegexException do timeoutExceptionHandler(timedout);
    create pattern;
    pattern.setTimeoutValue(1000).compile(possiblyDangerousRegex);
    pattern.findFirst(text, match);
    if timedout then
        logger.info("the user-provided expression '"&possiblyDangerousRegex&"' 
                    timed out.");
        return null;
    endif;
    return match.value;
epilog
    delete match;
    delete pattern;
end;

Because a pattern can be inefficient, malicious, or the provided data so big that the Regex operation can take far too long, you can call this method if you want a single Regex operation to time out after a specified number of milliseconds.

By default, Regex operations do not time out.

2020.0.01 and higher