setExplicitCapture

setExplicitCapture(enable: Boolean): JadeRegexPattern;

This fluent‑style method returns its own modified receiver, to allow call chaining. (By default, matches do not contain JadeRegexCapture objects for all your capture groups.)

Call the setExplicitCapture method of the JadeRegexPattern class with the enable parameter set to true to set the option that causes capture groups to be collated and returned as JadeRegexCapture objects with any match.

The following is an example of the setExplicitCapture method.

setExplicitCaptureExample();
constants
    PatternStr = "(\w+)\s*=\s*(\w+)";
    Text = "key = value";
vars
    pattern : JadeRegexPattern;
    match : JadeRegexMatch;
    i : Integer;
begin
    create pattern;
    pattern.setExplicitCapture(true).compile(PatternStr);
    pattern.match(Text, match);
    write match.numCaptures; // 2
    write match.at(1).value; // "Key"
    write match.at(2).value; // "value"
epilog
    delete pattern;
    delete match;
end;

You can set the explicit capture of all capture groups before or after you call the compile method.

2020.0.01 and higher