meta data for this page
  •  

ibec_preg_Replace

Syntax

  function ibec_preg_Replace(Pattern : string; Replacement : string; Subject : string) : string; 

The ibec_preg_Replace function searches Subject for matches to Pattern and replaces them with Replacement. If matches are found, the new Subject will be returned, otherwise Subject will be returned unchanged.

Example

The following example removes all IB comments (/*…*/) from a text:

  execute ibeblock
  as
  begin
    s = ibec_LoadFromFile('C:\SomeScript.sql');
    sPattern = '/\*/*([^/]*\*+)+/';
    s = ibec_preg_replace(sPattern, '', s);
    ibec_SaveToFile('C:\ScriptNoComments.sql', s, __stfOverwrite);
  end

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