rexMatch

C Styled Script
Reference Manual

<< Back  End  Next >>
 
 
INDEX
Introduction
Installation
Using The CSS Executive
Language
Directives
System Library
String Library
Regular Expression Lib.
   Basic Matching Rules
   Additional Syntax Specs
   Order Of Precedence
   rexClose
   rexMatch
   rexOpen
   Sample
File Library
Database Library
C API
C++ API
CSS Links
  
rexMatch(             // compile regular expression
   const handle,         // rex handle
   const string,         // string to match
   const nmatch,         // # of matches to find
   var &match[][],       // index & length of every match
  [const flags]);        // match flags

Compares the string against the compiled regular expression represented by handle to find a match between the two.

nmatch is the number of substrings in string that rexMatch should try to match with subexpressions in handle. The array you supply for match must have at least nmatch by 2 elements.

rexMatch fills in the elements of the array match with the starting index and the length of the matched substrings. The zeroth element of the array corresponds to the entire pattern. If there are more than nmatch subexpressions, only the first nmatch - 1 are stored.

If nmatch is 0, or if the rexOpenNosubreps flag was set when handle was created with rexOpen, rexMatch ignores the match argument and only returns 0 or 1 indicating if a match was found.

flags defines customizable behavior of rexMatch:

Flag Description
rexMatchNotbol Indicates that the first character of string is not the beginning of line.
rexMatchNoteol Indicates that the last character of string is not the end of line.

When a basic or extended regular expression is matched, any given parenthesized subexpression of the original pattern could participate in the match of several different substrings of string. The following rules determine which substrings are reported in pmatch:

  1. If a subexpression participated in a match several times, rexMatch stores index and length of the last matching substring in match.

  2. If a subexpression did not match in the source string, the number of matches returned is less than nmatch.

  3. If a subexpression contains subexpressions, the data in match refers to the last such subexpression.

If the rexOpenNosubreps flag was set when handle was created byrexOpen, the contents of match are unspecified. If therexOpenNewline flag was not set when handle was created, new-line characters will not be treated as end-of-line.

Return value

If a match is found, rexMatch returns the number of matches including subreports. If no match is found rexMatch returns O.

 Copyright © IBK LandquartLast revised by Peter Koch, 24.02.00<< Back  Top  Next >>