In 3.0.4 the below gives true for all 4 lines
In 3.2.0 the last 2 matches give false.
0* does not match 00 when it appears in the middle of an expression
program Project1;
{$mode objfpc}{$H+}
uses
RegExpr;
var
FRegX: TRegExpr;
begin
FRegX := TRegExpr.Create;
FRegX.ModifierI := True;
FRegX.Expression := '0*';
writeln( FRegX.Exec('00)') ); // True
FRegX.Expression := '0*\)';
writeln( FRegX.Exec('00)') ); // True
FRegX.Expression := '^0*';
writeln( FRegX.Exec('^00') ); // True
FRegX.Expression := '^0*\)';
writeln( FRegX.Exec('^00)') ); // False / Wrong
FRegX.Expression := 'P0*';
writeln( FRegX.Exec('P00') ); // True
FRegX.Expression := 'P0*\)';
writeln( FRegX.Exec('P00)') ); // False / Wrong
FRegX.Free;
readln;
end.
_______________________________________________
fpc-devel maillist - [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel