RegEx.ExecNext

Top  Previous  Next

 

Syntax

function RegEx.ExecNext(RegEx: pointer): boolean

 

Alternative Names

RE.ExecNext
ibec_re_ExecNext

 

Description

Attempts to find the next match for a regular expression in a text previously set by calling RegEx.Exec.

 

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

 

Returns TRUE is a match has been found, FALSE otherwise.

 

See also

RegEx.Create
RegEx.Exec
RegEx.Free

 

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;