findFirstInSubstring

findFirstInSubstring(text:     String;
                     startPos: Integer;
                     len:      Integer;
                     splits:   JadeRegexMatch io): Boolean;

The findFirstInSubstring method of the JadeRegexPattern class searches a portion of the specified text for the first occurrence of the specified pattern. If one is found within that portion, the details of the match are recorded as a JadeRegexMatch object. The portion of the text over which to search is specified using the start position and length parameters.

This method is the same as the findFirst method, except that you can limit the search using the startPos and len parameters.

You can specify a valid JadeRegexMatch object to store the match details or if the match parameter is null, a JadeRegexMatch object is created for you.

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

findFirstInSubstrExample();
constants
    SomeLongUnimportantText = "i dont need to be parsed";
vars
    text : String;
    pattern : JadeRegexPattern;
    match : JadeRegexMatch;
begin
    text := SomeLongUnimportantText&"peter piper picked a peck of pickled peppers";
    create pattern;
    pattern.compile("pickle.?");
    pattern.findFirstInSubstring(text, SomeLongUnimportantText.length, text.length 
                                 - SomeLongUnimportantText.length, match);
    write match.value; // pickled
epilog
    delete pattern;
    delete match;
end;

This method returns true if the pattern is found in the specified portion of the text; otherwise it returns false.

2020.0.01 and higher