GetMatch Method (REGEX)


 

The GetMatch method is used to return the last successful matched substring in the associated PL/B REGEX object. This method uses the following format:

 

 

[label]

{object}.GetMatch

[GIVING {return}]

 

Where:

label

Optional. A Program Execution Label.

object

Required. A REGEX object previously declared.

return

Optional. A Character String Variable that returns the last successful matched substring.

Flags Affected: EOS, OVER, ZERO

Notes:

  1. The EOS flag is set if the returned data string is larger than the DIM variable used to receive the data.

  2. The OVER and ZERO Condition Flags are always cleared.

  3. This method returns the value of the most recent successful method:

  4.  

    Method

    Returns the

    Count

    last match.

    IsMatch

    first matched text.

    Match

    returned match.

    MatchAll

    last match.

    Replace

    replaced substring.

    ReplaceAll

    last replaced substring.

     ReplaceEx

    replaced substring.

    Search

    first match.

    Split

    last separator match.

    Test

    matched text.

     

  5. The GetMatch method returns the object's cached last match. A match can be empty (zero-length), so an empty GetMatch does not by itself mean there was no match.

  6. The object's last-match cache is cleared on the Compile method, Reset method, any no-match result and any no-replacement result..

 

Example 1:

 

      RegEx1.GetMatch Giving S

 

See Also: Method Syntax, REGEX, Regular Expression Support



PL/B Language Reference