findAll

findAll(text:            String;
        pattern:         String;
        ignoreCase:      Boolean;
        explicitCapture: Boolean;
        matches:         JadeRegexResult io): Integer;

The findAll method of the JadeRegex class searches the entire specified text looking for all occurrences of the specified pattern. Any matches that are found are collated into a JadeRegexResult object. If the value of the matches parameter is not null, it populates the existing JadeRegexResult object; otherwise it creates a new JadeRegexResult object. This method returns the number of matches that are found, or it returns zero (0) if none are found.

The findAll method parameters are described in the following table.

Parameter Description
text Text string within which to find a match.
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.
matches JadeRegexResult contains zero (0) or more matches that are found. (Although you do not need to create this object, it will be used to store the matches if you do.)

The following is an example of a findAll type method.

findAllExample();
constants
    Text = "the quick brown fox jumped over the lazy dog";
    PatternStr = "\b[\w]{3,4}\b";
vars
    matches : JadeRegexResult;
    match : JadeRegexMatch;
    i : Integer;
begin
    JadeRegex@findAll(Text, PatternStr, true, false, matches);
    foreach i in 1 to matches.numMatches do
        match := matches.at(i);
        write match.value;
    endforeach;
    /* writes:
    the
    fox
    over
    the
    lazy
    dog
    */
epilog
    delete matches;
end;

2020.0.01 and higher