SRL Archive - OSR Help

RegEx Change in SRL 6


mrlewcc

2013-11-06 12:19:18

Alright am I being retarded or something, I cannot figure out how to update RegEx to the new SRL 6 could anyone help me out?

Thanks :)

function SplitRegExprEx(Expr, Data: string): TStringArray;
var
DataArr: TStringList;
I: integer;
begin
DataArr := TStringList.Create;
try
SplitRegExpr(Expr, Data, DataArr);
SetArrayLength(Result, DataArr.Count);
for I := 0 to DataArr.Count - 1 do
Result[I] := DataArr.Strings[I];
finally
DataArr.Free;
end;
end;

Error is: Exception in Script: Unknown declaration "SplitRegExpr" at line 58, column 5

bg5

2013-11-06 12:50:08

From: mrlewcc
Alright am I being retarded or something, I cannot figure out how to update RegEx to the new SRL 6 could anyone help me out?

Thanks :)

function SplitRegExprEx(Expr, Data: string): TStringArray;
var
DataArr: TStringList;
I: integer;
begin
DataArr := TStringList.Create;
try
SplitRegExpr(Expr, Data, DataArr);
SetArrayLength(Result, DataArr.Count);
for I := 0 to DataArr.Count - 1 do
Result[I] := DataArr.Strings[I];
finally
DataArr.Free;
end;
end;

Error is: Exception in Script: Unknown declaration "SplitRegExpr" at line 58, column 5


It's not SRL6, it's lack of this function in Lape. Propably because Lape doesn't use TStringList class. I think w Devs should add replacement to Lape, because I'm big fan of backward compability^^.

Here is your code:

function SplitRegExprEx(Expr, Data: string): TStringArray;
begin
Data := ReplaceRegExpr(Expr,Data,#1,true);
ExplodeWrap(#1,Data,Result);
end;

It's not optimized, because it does almost same thing x2, but it can not be done better.