ScriptCore3.SplitRegExpr

From Soldat Community Wiki
Jump to: navigation, search
procedure SplitRegExpr (const ARegExpr, AInputStr: string; APieces : TStrings);
 ARegExpr: regular expression
 AInputStr: string to be split
 APieces: result of split as TStrings 

Description

Split AInputStr into APieces by r.e. ARegExpr occurencies

For detailed information about Regular Expressions see Regular_Expression on Wikipedia

Example

const
  Reg = 'line';
  Str = '0line1line2line3line4';

var
  Res: TStringList;

begin
  Res := File.CreateStringList;
  
  SplitRegExpr(Reg,Str,Res);
  
  WriteLn(Res.Text);
  {
  0
  1
  2
  3
  4
  
  }
  
  Res.Free;
end.