RegEx.Match

Top  Previous  Next

 

Syntax

function RegEx.Match(RegEx: pointer; Index: integer): string

 

Alternative Names

RE.Match
ibec_re_Match

 

Description

Returns the matched text.

 

RegEx is a previously created Regular Expression object by calling RegEx.Create.

 

The Index parameter returns the current match found by RegEx.Exec when using zero, or an additional match when using a number greater than zero.

 

Returns the text from the original input that matches the regular expression.

 

See also

RegEx.Create
RegEx.Exec
RegEx.Free
RegEx.FindMatches

 

Example

execute udsblock 

as

begin

  /* create the object with an expression */

  re = RegEx.Create('[_a-zA-Z\d\-\.]+@[_a-zA-Z\d\-]+(\.[_a-zA-Z\d\-]+)+'); 

 

  try

    /* find matches in a text */

    Res = RegEx.Exec(re, 'test m@nu.nl and then some z@example.com and more, @, test. finally fake@web.com');

    while (Res <> __FALSE)

    do begin

         /* a match has been found, display it */

     email = RegEx.Match(re, 0);

         GUI.ShowMessage('Found e-mail: ' || email);

 

         /* attempt to find the next match */

         Res = RegEx.ExecNext(re);

       end

  finally

    RegEx.Free(re);

  end

end;