[fpc-devel] TRegExpr serious regression in 3.2.0

Martin Frb lazarus at mfriebe.de
Sun Jan 3 16:26:46 CET 2021


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.



More information about the fpc-devel mailing list