regexpression ignores changed to modifier
Original Reporter info from Mantis: Martin @martin_frb
-
Reporter name: Martin Friebe
Original Reporter info from Mantis: Martin @martin_frb
- Reporter name: Martin Friebe
Description:
The following code matches the same pattern twice, but changes the ModifierI.
The match after the change is performed as if the modifier was not changed.
Works fine in 3.0.4
Steps to reproduce:
program Project1;
{$mode objfpc}{$H+}
uses
RegExpr;
var
RegExprEngine : TRegExpr;
begin
// first "NOT ignore case"
RegExprEngine := TRegExpr.Create();
RegExprEngine.ModifierI := False; // Do not ignore case
RegExprEngine.Expression := '(t...),';
RegExprEngine.InputString := 'Text and more Text, texting';
writeln(RegExprEngine.ExecPos(1));
WriteLn(RegExprEngine.MatchPos[0]);
RegExprEngine.ModifierI := True;
RegExprEngine.Expression := '(t...),';
RegExprEngine.InputString := 'Text and more Text, texting';
writeln(RegExprEngine.ExecPos(1));
WriteLn(RegExprEngine.MatchPos[0]);
// first "ignore case"
RegExprEngine := TRegExpr.Create();
RegExprEngine.ModifierI := True;
RegExprEngine.Expression := '(t...),';
RegExprEngine.InputString := 'Text and more Text, texting';
writeln(RegExprEngine.ExecPos(1));
WriteLn(RegExprEngine.MatchPos[0]);
RegExprEngine.ModifierI := False; // Do not ignore case
RegExprEngine.Expression := '(t...),';
RegExprEngine.InputString := 'Text and more Text, texting';
writeln(RegExprEngine.ExecPos(1));
WriteLn(RegExprEngine.MatchPos[0]);
ReadLn;
end.
----
Output
FALSE
-1
FALSE // should be true
-1
TRUE
15
TRUE // should be false
15
Mantis conversion info:
- Mantis ID: 38442
- OS: win 10
- OS Build: 10
- Build: 48511
- Platform: 64bit Intel
- Version: 3.2.1
- Fixed in version: 3.3.1
- Fixed in revision: 49047 (#a1c392e0)
- Target version: 4.0.0