findFirst

findFirst(text:            String;
          pattern:         String;
          ignoreCase:      Boolean;
          explicitCapture: Boolean;
          match:           JadeRegexMatch io): Boolean;

The findFirst method of the JadeRegex class searches the specified text for an occurrence of the specified pattern. If one is found, the details of the match are recorded as a JadeRegexMatch object. This method returns true if a match was found; otherwise it returns false.

The findFirst method parameters are described in the following table.

Parameter Description
text Text string within which to find matches.
pattern Regex pattern string.
ignoreCase Specifies whether matching is case-sensitive.
explicitCapture Specifies whether to generate JadeRegexCapture objects for each sub‑match if your pattern contains capture groups.
match JadeRegexMatch 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.)

The following is an example of a findFirst type method.

typeFindFirst();
vars
    match : JadeRegexMatch;
begin
    if JadeRegex@findFirst("the error is reported in application.log", 
                           "\b[\w]+.log", false, false, match) then
        write match.value; // writes "application.log"
    endif;
end;

2020.0.01 and higher