util.Regexp.getMatch

Returns the text of the first (leftmost) match of the regular expression in the subject.

Syntax

util.Regexp.getMatch(
  subject STRING
 )
  RETURNS STRING
  1. subject is the string to be scanned.

Usage

The getMatch() method returns the first occurrence of the string matching the regular expression, in the string passed as parameter.

The method returns NULL, if the passed string does not contain any matching string for the current regular expression.

Example

IMPORT util
MAIN
    DEFINE re util.Regexp
    LET re = util.Regexp.compile(`[ABC]XX`)
    DISPLAY re.getMatch("ZZZZBXXZZZ")
END MAIN
Output:
BXX