findFirst

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

The findFirst method of the JadeRegexPattern class searches the specified text for the first occurrence of the pattern. If one is found, the details of the match are recorded as a JadeRegexMatch object.

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.

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

findFirstExample();
vars
    match : JadeRegexMatch;
    pattern : JadeRegexPattern;
begin
    create pattern;
    pattern.compile("\b[\w]+.log");
    pattern.findFirst("the error is reported in application.log", match);
    write match.value; // writes: application.log
epilog
    delete pattern;
    delete match;
end;

This method returns true if the string specified in the text parameter matches the pattern within a string; otherwise it returns false. The match can be a substring of the specified text rather than the whole string.

2020.0.01 and higher