/sys$common/syshlp/TPUHELP.HLB  —  MATCH
  MATCH

     Returns a pattern that matches all the characters starting at the
     current character position and continuing up to and including the
     sequence of characters specified in the parameter string, range, or
     buffer.  The pattern that MATCH returns does not cross record (line)
     boundaries.

  Syntax

     pattern := MATCH ({string | range | buffer})

  Parameters

     string               A quoted string or an expression that evaluates to
                          a string.  MATCH stops matching when it finds the
                          end of this string.

     range                A range or an expression that evaluates to a
                          range.  MATCH forms a string out of the contents
                          of the range and stops matching when it reaches
                          the end of the resulting string.

     buffer               A buffer or an expression that evaluates to a
                          buffer.  MATCH forms a string out of the contents
                          of the buffer and stops matching when it reaches
                          the end of the resulting string.

  Examples

     The following assignment statement stores in pat1 a pattern that will
     match a string of characters starting with the current character
     position up to and including the characters "abc".

     pat1 := MATCH ('abc');

     The following procedure finds text within double angle brackets.  It
     moves the current character position to the beginning of the bracketed
     text, if it exists.  For example, this procedure would match the text
     <<abc>>.

     PROCEDURE user_angle_brackets
        paren_text    := '<<' + MATCH ('>>');
        found_range   := SEARCH_QUIETLY (paren_text, FORWARD, NO_EXACT);
        IF found_range = 0   ! No match
           THEN MESSAGE  ('No match found.');
           ELSE POSITION (found_range);
        ENDIF
     ENDPROCEDURE

  Related Topics

        SEARCH     SEARCH_QUIETLY
Close Help