meta data for this page
  •  

ibec_preg_Match

Description

The ibec_preg_Match function searches Subject for a match to the regular expression given in Pattern.

It returns TRUE if a match for Pattern was found in the Subject string, or FALSE if no match was found or an error occurred.

If Matches is specified, then it is filled with the results of the search.

Syntax

  function ibec_preg_Match(Pattern : string; Subject : string [; Matches : array of variant) : Boolean;

Example

The following example returns a list of all email addresses used in a text file:

  execute ibeblock     returns (
    Email varchar(200))
  as
  begin
    s = ibec_LoadFromFile('C:\SomeData.txt');
    sPattern = '([_a-zA-Z\d\-\.]+@[_a-zA-Z\d\-]+(\.[_a-zA-Z\d\-]+)+)';
    ibec_preg_match(sPattern, s, aEmails);
    foreach (aEmails as Email skip nulls) do
      suspend;
  end

To learn more about the syntax of regular expressions available in IBExpert, please refer to Regular Expressions explained.