The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....


Class: TGrep
Declaration: function TGrep.MatchString (Instring: string; var MatchPos: integer): boolean;

The method MatchString matches the regular expression (as defined by the property RegExp) against the string Instring starting at the position defined by the property SearchStartPos. The function returns a TRUE value, if a match has been found. In this case the parameter MatchPos contains the starting index of the matching position. The indices of the first and the last matched character in the string Instring are available in the readonly properties MatchStartPos and MatchEndPos.

Note 1: More detailed information on the match can be obtained by using the array property RegExpToken.

Note 2: The parameter MatchPos and the property MatchStartPos are the same. These two identifiers are kept in parallel for compatibility reasons. Future developments should use the property MatchStartPos.

Example: This method is used in the following example program (see for downloading the code): grep

Last Update: 2012-Okt-20