BeRo1985 / flre

FLRE - Fast Light Regular Expressions - A fast light regular expression library
GNU Lesser General Public License v2.1
94 stars 23 forks source link

PtrPosChar wrong size #82

Closed benibela closed 2 years ago

benibela commented 3 years ago

PtrPosChar and related functions have Size:=(TextLength-Offset)+1;

But offset seems to be 0 based, so this has the wrong size

Thus this finds three matches when there are only two:

var
  f: TFLRE;
  captures: TFLREMultiCaptures;
  i: Integer;
begin
  f := TFLRE.Create('\x00', []);
  f.UTF8MatchAll('a'#00'b'#00'c', captures);
  for i := 0 to high(captures) do writeln(captures[i][0].Start, ' ',captures[i][0].Length);