anchor.diff:       end;
       end;
       opEOT:begin
  -     if (Position+1)>=InputLength then begin
  +     if rfUTF8 in Flags then begin
  +      OtherPosition:=Position;
  +      UTF8PtrSafeInc(ThreadLocalState.Input,ThreadLocalState.InputLength,OtherPosition);
  +     end else begin
  +      OtherPosition:=Position+1;
  +     end;
  +     if OtherPosition>=ThreadLocalState.InputLength then begin
         Instruction:=Instruction^.Next;
         continue;
        end else begin
  
positive.code:        CountObviousPrefixCharClasses:longint;
         PrefixPatternBitMasks:TFLRECharPatternBitMasks;
  
         Input:pansichar;
         InputLength:longint;
  
         ByteMap:TFLREByteMap;
         UnByteMap:TFLREByteMap;
         ByteCharSetMap:TFLRECharClass;
  
negative.code:   ThreadLocalStateCriticalSection.Leave;
   end;
   try
    ThreadLocalState.Input:=AInput;
    ThreadLocalState.InputLength:=AInputLength;
    repeat
     case SearchMatchDFA(ThreadLocalState,StartPosition,UntilExcludingPosition,MatchEnd,UnanchoredStart) of
      DFAMatch:begin
       if UnanchoredStart then begin
        // For unanchored searchs, we must do also a "backward" DFA search
        case SearchMatchReversedDFA(ThreadLocalState,MatchEnd,StartPosition,MatchBegin) of
         DFAMatch:begin
          if MatchBegin<StartPosition then begin
           MatchBegin:=StartPosition;
  