match

match(text:  String;
      match: JadeRegexMatch io): Boolean;

The match method of the JadeRegexPattern class determines if the specified text to search completely matches the pattern. This is a more‑capable form of the isMatch method, as it records any match, including any capture groups in the pattern, as a JadeRegexMatch object. This method returns true if the whole of the text string matches the pattern; otherwise it returns false.

The following is an example of a match operation with a customized pattern.

matchExample();
vars
    compiledPattern : JadeRegexPattern;
    match : JadeRegexMatch;
begin
    create compiledPattern;
    compiledPattern
        .setIgnoreCase(true)
        .setExplicitCapture(true)
        .compile("(?'iniOption'[a-z1-9_-]+)\s*=\s*(?'value'[a-z1-9_<>-]+)");
    if compiledPattern.match("EnableSentinel=<default>", match) then
        match.inspectModal;
    write "Option = "&match.getCaptureByName("iniOption").value; 
         // writes "EnableSentinel"
    write "Option value = "&match.getCaptureByName("value").value; 
        // writes "<default>"
    endif;
end;

The JadeRegexMatch object contains details about the match such as all capture groups for the match and the position within text of a successful match. Although you can specify a valid JadeRegexMatch object to store the match details, if the match parameter is null, a JadeRegexMatch object is created for you.

2020.0.01 and higher